Commit Graph

1385 Commits

Author SHA1 Message Date
Tyler Erickson
a5bc36de26 Removing werror option as meson has a built-in option for this
Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
2025-10-24 09:48:56 -06:00
Tyler Erickson
3723b182db bug: Fixing runtime issue with test_util_file.c in Windows
Windows was failing tests due to how the Windows API works with some of the calls used.
When opening and reading a file O_BINARY is needed otherwise it fails for size checks. This is due to how Windows handles newlines and counts between text and binary mode file reads.

Also fixed is the test for /dev/null.
In Windows, this fails, but crashes due to a missing return statement when it cannot open this file.
I also tried telling windows to open the special file NUL, however that leads to a CRT crash later in the test that cannot be stopped and will always fail. Rather than fail a test that Windows will always fail, it has been disabled in that specific case.

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
2025-10-20 12:10:57 -06:00
Tyler Erickson
e3a33ae8ae make: Adding support for building json-c with meson
Adding meson build files for json-c that work similarly to the cmake build files.
Where it made sense, I reused existing cmake .h.in files or generated entirely from meson.
All tests were done with GCC and Clang in ubuntu 24.04, Windows using MSVC 2022 and Clang-cl from llvm's repo using version 21.1.3

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
2025-10-20 12:08:01 -06:00
Tyler Erickson
461d9f90c4 bug: Fixing Cmake build when using clang-cl
Clang-cl will fail to build and produce warnings about redefining existing symbols, mostly for float.h and math.h compatibility.

To resolve this, this moves the clang-cl detection earlier in the CMakeLists.txt so that CLANG_CL can be checked properly where there is an existing MSVC workaround for these symbols.
This resolves the build using the latest clang-cl from the LLVM clang repo as well as clang-cl that can be installed with MSVC 2022.

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
2025-10-20 11:39:04 -06:00
Eric Hawicz
2372e9518e Merge pull request #893 from sffc/supplemental-code-point-bug
Fix bug involving supplemental code points that look like high surrogates
2025-08-07 09:46:47 -04:00
Shane F. Carr
7974657c56 Fix code and update tests 2025-07-30 17:40:56 -07:00
Shane F. Carr
dbefb48948 Add tests with current behavior 2025-07-30 17:39:47 -07:00
Eric Hawicz
bf92456789 Make json_parse a bit more useful by adding -u (validate UTF8) and -P (specify arbitrary tokener parse flags), and read from stdin if no filename is provided. 2025-07-08 21:04:00 -04:00
Eric Hawicz
7cee5237dc Issue #867 - also disallow control characters in keys 2025-04-03 21:16:29 -04:00
Eric Hawicz
7bca694b47 Merge pull request #884 from careles/mingw_win64-WIN32_LEAN_AND_MEAN-redefined
fix macro WIN32_LEAN_AND_MEAN redefined
2025-01-09 00:12:09 -05:00
Careles
51bcdd0000 fix macro WIN32_LEAN_AND_MEAN redefined
json-c as add_subdirectory and project cmakelists.txt has add_definitions(-DWIN32_LEAN_AND_MEAN)
2025-01-06 10:56:53 +08:00
Eric Hawicz
a304464807 Merge pull request #872 from GitMensch/patch-2
fix linkhash breaking -std=c89
2024-12-29 13:34:38 -05:00
Eric Hawicz
7b73916815 Merge pull request #847 from sacredbanana/amiga
Add support for Commodore Amiga
2024-12-29 13:26:11 -05:00
Eric Hawicz
ee83daa409 Merge pull request #882 from simonresch/handle-nan-to-int-conversion
Explicitly handle NaN values when converting to integer
2024-12-26 19:07:07 -05:00
Cameron Armstrong (Nightfox)
ca1a6b0cc9 Add support for MorphOS 2024-12-24 10:09:50 +08:00
Cameron Armstrong (Nightfox)
daff6eb746 Remove linking to libamiga and libc 2024-12-24 10:09:50 +08:00
Cameron Armstrong (Nightfox)
254b5abef8 Do not use duplocale if building for libnix because it isnt supported yet 2024-12-24 10:09:50 +08:00
Cameron Armstrong (Nightfox)
d31d635af1 Clean up CMakeLists.txt and remove Amiga specific locale.h guard 2024-12-24 10:09:50 +08:00
Cameron Armstrong (Nightfox)
743ebf53e5 Fix Readme 2024-12-24 10:09:50 +08:00
Cameron Armstrong
f928e7c0fa Get working ror libnix and clib2 2024-12-24 10:09:50 +08:00
Cameron Armstrong
4feebc1cd6 Add support for Commodore Amiga 2024-12-24 10:09:50 +08:00
Eric Hawicz
961c31f8ed Merge pull request #879 from janotomko/null
Handle NULL gracefully in json_tokener_free
2024-12-07 13:33:05 -05:00
Simon Resch
0c3588330a Set error codes for truncating int conversions
json_object_get_int/int64/uint64() now sets errno to ERANGE when the source value
can't be represented in the target type.
2024-11-27 07:17:20 +01:00
Simon Resch
8c13801f2c Explicitly handle NaN values when converting to int
Json objects of type double with the value NaN could cause undefined
behavior when casting double to int in `json_object_get_int`.
2024-11-27 07:17:20 +01:00
Eric Hawicz
c63d4a4194 Merge pull request #878 from 0xfadead/readme-fix-underline
Fix underline bug in README
2024-11-23 19:39:50 -05:00
Eric Hawicz
77bb5c54fc Merge pull request #883 from simonresch/add-oss-fuzz-tests
Add fuzz tests for json_object/point/array apis
2024-11-23 19:39:13 -05:00
Simon Resch
839fbe0d63 Add fuzz tests for json_object/point/array apis
Extends the coverage of fuzz tests executed in OSS-Fuzz.
2024-11-22 07:43:32 +01:00
Eric Hawicz
ff8ed0f094 Issue #881: don't allow json_tokener_new_ex() with a depth < 1 2024-11-17 22:11:24 -05:00
Eric Hawicz
565f181f65 Fix issue #875: cast to unsigned char so bytes above 0x7f aren't interpreted as negative, which was causing the strict-mode control characters check to incorrectly trigger. 2024-11-08 22:20:40 -05:00
Ján Tomko
828c12b226 Handle NULL gracefully in json_tokener_free
Similarly to glibc's free, make json_tokener_free(NULL)
a no-op, to simplify cleanup paths.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2024-11-06 15:23:00 +01:00
Eric Hawicz
474ee12435 Fix the apps/json_parse "-s" (strict) option so it actually does something, and default to non-strict. 2024-11-03 19:44:21 -05:00
Awildidiot
d6b973e047 Fix underline bug in README 2024-11-03 20:03:49 +01:00
Eric Hawicz
07148f33a1 Merge pull request #873 from esiaero/master
Correct year in changelog for 0.18 release
2024-10-10 20:55:18 -04:00
Evan Si
2ec0b87b58 Correct year in changelog for 0.18 release 2024-10-10 23:47:55 +00:00
Simon Sobisch
6aab3da807 fix linkhash breaking -std=c89
making the definition of _LH_INLINE depending on __STDC_VERSION__, not on a specific compiler
2024-10-07 08:16:42 +00:00
Eric Hawicz
c793374f16 Update openssl command to work for newer versions of openssl. 2024-09-15 13:16:48 -04:00
Eric Hawicz
e9bd26d568 Update the master branch to version 0.18.99 2024-09-15 13:06:06 -04:00
Eric Haszlakiewicz
7ebdc4ddf8 Update abi-check.sh to compare 0.16 and 0.18 2024-09-15 16:10:57 +00:00
Eric Hawicz
87900c0a2e Fix the expected output for test_parse 2024-09-15 11:59:05 -04:00
Eric Hawicz
e5ca4d3b3d Update ChangeLog, AUTHORS and issues_closed_for_0.18.md for an upcoming 0.18 release. 2024-09-15 11:54:50 -04:00
Eric Hawicz
e3db88d114 Merge pull request #871 from json-c/disallow-control-chars
Issue #867: disallow control characters in strict mode.
2024-09-15 11:22:58 -04:00
Eric Hawicz
6bfab90c87 Issue #867: disallow control characters in strict mode. 2024-09-15 10:37:45 -04:00
Eric Hawicz
ecb7a4c9a3 Merge pull request #864 from pavelzw/patch-1
Build pkg-config for msvc as well
2024-08-29 21:08:52 -04:00
Pavel Zwerschke
906d1581de Update CMakeLists.txt 2024-08-29 10:55:02 +02:00
Pavel Zwerschke
9b8d170d1f Build pkg-config for msvc as well 2024-06-18 00:11:13 +02:00
Eric Hawicz
6e481aa061 Merge pull request #861 from bhaible/handle-another-oom-condition
Handle yet another out-of-memory condition.
2024-05-05 09:49:26 -04:00
Eric Haszlakiewicz
781675758f Although CMAKE_C_COMPILER_FRONTEND_VARIANT is defined, it's not always set to some value. Fix builds for cases when it's blank. 2024-04-28 17:15:42 +00:00
Bruno Haible
833233faa8 Handle yet another out-of-memory condition.
duplocale() can return NULL, with errno set to ENOMEM.
In this case, bail out and set the current error code to
json_tokener_error_memory.
2024-04-22 01:54:10 +02:00
Eric Hawicz
31a22fb2da Issue #857: fix a few places where json_tokener should have been returning json_tokener_error_memory but wasn't. 2024-04-21 10:37:16 -04:00
Eric Hawicz
0051f2dbe0 Merge pull request #858 from alurm/master
json_tokener.h: json_tokener_parse_verbose: fix typo
2024-04-16 11:23:09 -04:00