Eric Hawicz [Sat, 23 May 2026 18:27:32 +0000 (14:27 -0400)]
Issue #927: update the documentation for json_object_iterator to clarify that any change of the fields present on the object being iterated invalidates the iterator.
Update the test to show what kind of changes _are_ allowed.
Milan Broz [Tue, 12 May 2026 19:33:14 +0000 (21:33 +0200)]
Fix function prototypes in deep nesting test (clang compilation)
This patch fixes the build error with clang-21
tests/test_deep_nesting.c:19:34: error: a function declaration
without a prototype is deprecated in all versions of C
[-Werror,-Wstrict-prototypes]
19 | static char *generate_json_string()
by fixing generate_json_string() definition.
It also removes prototypes for static functions that are not needed.
lone [Mon, 9 Feb 2026 06:01:38 +0000 (14:01 +0800)]
general callback, safer API & related tests
- Changed json_pointer_set_with_array_cb to json_pointer_set_with_cb, related cb updated
- Added tests(test_safe_json_pointer_set.*) for new-exported funcs, also updated cmake & meson
lone [Sun, 25 Jan 2026 15:54:27 +0000 (23:54 +0800)]
Fix: OOM vulnerability cause by is_valid_index
An OOM vulnerability exists in the json_pointer_set function (and related functions).
See issue #916 for more details.
To fix that, added a sanity check in the is_valid_index function to limit the maximum value of a parsed array index.
Provided a configurable macro for modification.
JaisonZheng [Wed, 21 Jan 2026 09:28:20 +0000 (17:28 +0800)]
Fix memory leak on macOS by auto-enabling NEWLOCALE_NEEDS_FREELOCALE
macOS's newlocale() does not follow POSIX specification - it doesn't
reuse the passed locale_t, causing ~1,472 bytes leak per json_tokener_parse() call.
This is the same issue as #668 (FreeBSD). The existing workaround works,
but macOS was not auto-detected.
Tested with AddressSanitizer: leak drops from 1,472,000 bytes to ~120 bytes
(system init only).
Bruno Haible [Fri, 9 Jan 2026 22:51:43 +0000 (23:51 +0100)]
Support MSVC in packages that use GNU Autoconf.
Fixes https://github.com/json-c/json-c/issues/909
When ssize_t is defined as a macro, typically through a package's config.h file,
the installed json*.h files must not attempt to define ssize_t via typedef.
Lakshmi-Surekha [Thu, 27 Nov 2025 13:19:22 +0000 (07:19 -0600)]
apps: use CMake check for getopt.h
Add CMake detection for getopt.h and update json_parse.c to include it
only when HAVE_GETOPT_H is defined. Fixes AIX build failure.
Tyler Erickson [Mon, 20 Oct 2025 18:10:57 +0000 (12:10 -0600)]
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.
Tyler Erickson [Mon, 20 Oct 2025 18:08:01 +0000 (12:08 -0600)]
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
Tyler Erickson [Mon, 20 Oct 2025 17:39:04 +0000 (11:39 -0600)]
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.
Eric Hawicz [Wed, 9 Jul 2025 01:02:52 +0000 (21:02 -0400)]
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.
Eric Hawicz [Sat, 9 Nov 2024 03:20:40 +0000 (22:20 -0500)]
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.