Commit Graph

1434 Commits

Author SHA1 Message Date
Eric Hawicz
d1018cf6ba Update test_object_iterator.expect to match current test output. 2026-05-25 15:27:48 -04:00
Eric Hawicz
3e708e4c4f Drop osx from .travis.yml since macOS builds are no longer supported. 2026-05-24 16:15:19 -04:00
Eric Hawicz
6167807f3a Merge pull request #925 from mbroz/fix-build
Fix build with clang-21
2026-05-24 16:07:11 -04:00
Eric Hawicz
dee128f4d6 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.
2026-05-23 14:31:45 -04:00
Eric Hawicz
2bfda7114b Remove never used struct json_object_iter_info_ 2026-05-23 14:31:45 -04:00
Eric Hawicz
79474075ce Fix expected output for test_deep_nesting 2026-05-23 14:31:45 -04:00
Milan Broz
1f7589fa2f 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.
2026-05-12 21:46:50 +02:00
Eric Hawicz
ccd2803b3d Merge pull request #924 from json-c/put_no_recurse
avoid recursion during json_object_put
2026-05-03 20:49:09 -04:00
Eric Hawicz
17328a6713 Issue #923: Avoid stack recursion in json_object_put() so heavily nested object trees can be freed. 2026-05-03 20:44:28 -04:00
Eric Hawicz
e50fb04154 Add lh_table_delete_entry_to_tail() and array_list_set_idx() functions. 2026-05-03 20:44:08 -04:00
Eric Hawicz
5320cf9753 Add a test to check for issues with deeply nested objects, which can cause problems due to stack recursion. 2026-05-03 20:44:02 -04:00
Eric Hawicz
52ddfb35f1 Fix memory leak in test_safe_json_pointer_set, the caller must free the passed value when json_pointer_set failed. Also, reformat. 2026-02-19 19:05:10 -05:00
Eric Hawicz
8c987e0b73 Issue #919: Fix build on non-x86 windows. Patch thanks to @dotanbrk 2026-02-19 18:48:05 -05:00
Eric Hawicz
d7f14cb330 Merge pull request #917 from thely314/fix/oom-too-large-index
Fix: OOM vulnerability cause by is_valid_index
2026-02-14 17:23:49 -05:00
lone
c293d9b61c 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

Signed-off-by: lone <lonechan314@qq.com>
2026-02-09 14:01:38 +08:00
Eric Hawicz
8c01a7c32f Merge pull request #903 from neheb/1
Some checks failed
meson / Linux-GCC (13) (push) Has been cancelled
meson / Linux-GCC (9) (push) Has been cancelled
meson / Linux-Clang (22) (push) Has been cancelled
meson / Linux-Clang (9) (push) Has been cancelled
meson / VisualStudio (x64) (push) Has been cancelled
meson / VisualStudio (x86) (push) Has been cancelled
meson / VisualStudio-clang-cl (push) Has been cancelled
meson / MSYS2 (CLANG64) (push) Has been cancelled
meson / MSYS2 (UCRT64) (push) Has been cancelled
meson / Cygwin (push) Has been cancelled
meson / MacOS (push) Has been cancelled
meson / DragonflyBSD (push) Has been cancelled
meson / FreeBSD (push) Has been cancelled
meson / NetBSD (push) Has been cancelled
meson / OmniOS (push) Has been cancelled
meson / OpenBSD (push) Has been cancelled
meson / Alpine (aarch64) (push) Has been cancelled
meson / Alpine (armhf) (push) Has been cancelled
meson / Alpine (armv7) (push) Has been cancelled
meson / Alpine (ppc64le) (push) Has been cancelled
meson / Alpine (riscv64) (push) Has been cancelled
meson / Alpine (s390x) (push) Has been cancelled
meson / Alpine (x86) (push) Has been cancelled
meson / Alpine (x86_64) (push) Has been cancelled
meson: use override_dependency
2026-02-08 17:08:04 -05:00
Rosen Penev
d61b41c8bb github CI: add
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2026-02-05 13:46:00 -08:00
Rosen Penev
1d4885ad09 fix compilation with clang-cl
Something in the configure stage goes wrong where it believe strncasecmp
is present but the header defining it is not. Work around this.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2026-02-05 13:46:00 -08:00
Rosen Penev
92a4911e88 meson: use static library for tests
Needed as tests use private APIs that are not exported.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2026-02-05 13:46:00 -08:00
Rosen Penev
798d8f7235 meson: add license information
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2026-02-05 13:21:54 -08:00
Rosen Penev
a0c6bb32dd meson: simplify __thread check and fix MinGW
> was missing.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2026-02-05 13:21:54 -08:00
Rosen Penev
af2671a212 meson: use override_dependency
Allows wraps to use the dependency_names syntax instead of the possibly
changing variable syntax.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2026-02-05 13:21:54 -08:00
Eric Hawicz
46defb4349 Merge pull request #915 from jaisonZheng/fix-macos-locale-memory-leak
Fix memory leak on macOS by auto-enabling NEWLOCALE_NEEDS_FREELOCALE
2026-01-31 13:22:57 -05:00
lone
bda8299eb1 fix: adapt to the early C std
Signed-off-by: lone <lonechan314@qq.com>
2026-01-27 14:43:56 +08:00
lone
1c3b98ddb5 amend: removed marco related logic
Signed-off-by: lone <lonechan314@qq.com>
2026-01-26 17:54:53 +08:00
lone
22e470ac5c Fix: try to make json_pointer_set_with_array_cb a public api
make json_pointer_set_with_array_cb a public api, along with a function with wrapped callback

Signed-off-by: lone <lonechan314@qq.com>
2026-01-26 17:33:00 +08:00
lone
3d86402028 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.

Signed-off-by: lone <lonechan314@qq.com>
2026-01-25 23:54:27 +08:00
JaisonZheng
653a12c7c2 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).
2026-01-21 17:28:20 +08:00
Eric Hawicz
d05ea4851f Update ChangeLog, abi-check.sh, AUTHORS and issues_closed list for an upcoming 0.19 release. 2026-01-19 17:46:57 -05:00
Eric Hawicz
8948568031 Merge pull request #913 from mlocati-forks/dll-versioninfo
Add VERSIONINFO to libjson-c.dll
2026-01-18 15:25:29 -05:00
Michele Locati
b01b5b701b Add VERSIONINFO to libjson-c.dll 2026-01-18 20:23:50 +01:00
Eric Hawicz
26fcd8d569 Merge pull request #910 from bhaible/support-msvc-with-autoconf
Support MSVC in packages that use GNU Autoconf.
2026-01-09 23:18:40 -05:00
Bruno Haible
9774826e79 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.
2026-01-09 23:51:43 +01:00
Eric Hawicz
14c8e2e5ee Merge pull request #907 from travier/master-cmake4
tests/CMakeLists: Allow build with CMake 4
2025-12-29 23:42:24 -05:00
Timothée Ravier
e4b9dfba49 tests/CMakeLists: Allow build with CMake 4
See: https://github.com/json-c/json-c/issues/889
2025-12-23 11:52:43 +01:00
Eric Hawicz
a1249bfda0 Merge pull request #905 from glance-/fix-typo
Fix typo
2025-12-01 06:37:11 -05:00
Anton Lundin
dc44b05961 Fix typo
That include line wasn't valid code, so that resulted in:
Checking for size of "size_t" : -1

And later on:
json-c/json_patch.c:28:2: error: #error Unable to determine size of size_t
2025-12-01 11:37:59 +01:00
Eric Hawicz
20974e5f88 Merge pull request #904 from Lakshmi-Surekha/aix-getopt-dont-include
Include getopt.h header file if the platform is not AIX.
2025-11-29 11:40:00 -05:00
Lakshmi-Surekha
a7b34a299b 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.
2025-11-29 01:32:10 -06:00
Eric Hawicz
243ed1a51c Merge pull request #900 from neheb/1
meson cleanups
2025-11-04 18:32:47 -05:00
Rosen Penev
f565798e2c meson: remove useless if
get_supported_arguments already handles this.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2025-11-04 10:45:20 -08:00
Rosen Penev
8c012da8a6 meson: add header to size_t check
Might be needed under MSVC.
2025-11-04 10:45:20 -08:00
Rosen Penev
bd7355470e meson: replace target_machine with host_machine
The latter is the canonical way to express this.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2025-11-04 10:45:20 -08:00
Rosen Penev
40fe4d2b04 meson: use loops for checks
All of these are effectively the same. No point in duplicating it
everywhere.

Remove prefix from has_function. Apparently having the prefix in there
changes behavior.

Also fix an error on MinGW where SSIZE_T_MAX is undefined.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2025-11-04 10:44:42 -08:00
Eric Hawicz
2c412d4593 Merge pull request #899 from Seagate/meson_support
Meson support
2025-10-27 16:00:37 -04:00
Tyler Erickson
0883c24130 Merge branch 'json-c:master' into meson_support 2025-10-27 12:13:23 -06:00
Eric Hawicz
fbdd4bed24 Merge pull request #898 from Seagate/fix_cmake_clangcl
bug: Fixing Cmake build when using clang-cl
2025-10-25 09:46:22 -04:00
Eric Hawicz
33f4cb9353 Merge pull request #895 from nim65s/patch-1
CMake: sync minimum version
2025-10-25 09:45:50 -04:00
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