]> granicus.if.org Git - json-c/log
json-c
3 years agoGenerate docs for the 0.15 release json-c-0.15 json-c-0.15-20200726
Eric Haszlakiewicz [Sun, 26 Jul 2020 15:13:45 +0000 (15:13 +0000)]
Generate docs for the 0.15 release

3 years agoBump version to 0.15
Eric Haszlakiewicz [Sun, 26 Jul 2020 15:10:07 +0000 (15:10 +0000)]
Bump version to 0.15

3 years agoMerge pull request #648 from MarcT512/rbf
Eric Hawicz [Fri, 24 Jul 2020 02:26:58 +0000 (22:26 -0400)]
Merge pull request #648 from MarcT512/rbf

Fix "may be used uninitialized" Release build failure

3 years agoFix "may be used uninitialized" Release build failure
Marc [Thu, 23 Jul 2020 17:19:12 +0000 (18:19 +0100)]
Fix "may be used uninitialized" Release build failure

Fixes https://github.com/json-c/json-c/issues/647

3 years agoIssue #594 - provide an OVERRIDE_GET_RANDOM_SEED cmake variable to override json_c_ge...
Eric Haszlakiewicz [Wed, 22 Jul 2020 02:25:03 +0000 (02:25 +0000)]
Issue #594 - provide an OVERRIDE_GET_RANDOM_SEED cmake variable to override json_c_get_random_seed() for embedded platforms where time(NULL) doesn't work.

Example:
mkdir build && cd build
cmake -DOVERRIDE_GET_RANDOM_SEED='do { extern uint32_t getMsTicks(void); int ms = getMsTicks() * 433494437; return ms; } while(0)' ..

3 years agoMerge pull request #646 from pascal-cuoq/fix_645
Eric Hawicz [Wed, 22 Jul 2020 01:24:59 +0000 (21:24 -0400)]
Merge pull request #646 from pascal-cuoq/fix_645

Cast to unsigned char instead of int when calling tolower (Fixes #645)

3 years agoFixes #645
Pascal Cuoq [Tue, 21 Jul 2020 15:54:26 +0000 (17:54 +0200)]
Fixes #645

3 years agoUpdate the ChangeLog with recent changes, in preparation for a 0.15 release.
Eric Haszlakiewicz [Mon, 20 Jul 2020 03:39:01 +0000 (03:39 +0000)]
Update the ChangeLog with recent changes, in preparation for a 0.15 release.

3 years agoRemove the obsolete config.h.win32
Eric Haszlakiewicz [Fri, 17 Jul 2020 03:47:28 +0000 (03:47 +0000)]
Remove the obsolete config.h.win32

3 years agoFix a number of things with the generated docs, including translating triple-backtick...
Eric Haszlakiewicz [Fri, 17 Jul 2020 03:46:21 +0000 (03:46 +0000)]
Fix a number of things with the generated docs, including translating triple-backtick code blocks into a form doxygen understands.

3 years agoAdd some more detail about how to use json-c in README.md.
Eric Haszlakiewicz [Fri, 17 Jul 2020 03:42:38 +0000 (03:42 +0000)]
Add some more detail about how to use json-c in README.md.

3 years agoRemove the THIS_FUNCTION_IS_DEPRECATED define, we stopped using it long ago.
Eric Haszlakiewicz [Fri, 17 Jul 2020 03:20:29 +0000 (03:20 +0000)]
Remove the THIS_FUNCTION_IS_DEPRECATED define, we stopped using it long ago.

3 years agoRemove the obsolete README.json_object-split.md, and mark README.md as being the...
Eric Haszlakiewicz [Sun, 12 Jul 2020 19:16:19 +0000 (19:16 +0000)]
Remove the obsolete README.json_object-split.md, and mark README.md as being the doxygen mainpage.

3 years agoIssue #642: improve the docs for json_object_put() and json_object_get().
Eric Haszlakiewicz [Sun, 12 Jul 2020 18:43:27 +0000 (18:43 +0000)]
Issue #642: improve the docs for json_object_put() and json_object_get().

3 years agoExpand the doc for json_object_array_get_idx() to explain that it does not adjust...
Eric Haszlakiewicz [Sun, 12 Jul 2020 17:55:46 +0000 (17:55 +0000)]
Expand the doc for json_object_array_get_idx() to explain that it does not adjust refcounts.

3 years agoIssue #641: Add a cast to void * to address some theoretically undefined printf behavior.
Eric Haszlakiewicz [Sat, 11 Jul 2020 15:03:00 +0000 (15:03 +0000)]
Issue #641: Add a cast to void * to address some theoretically undefined printf behavior.

3 years agoIssue #642: improve docs for json_tokener.h and json_object_object_add().
Eric Haszlakiewicz [Sat, 11 Jul 2020 04:04:58 +0000 (04:04 +0000)]
Issue #642: improve docs for json_tokener.h and json_object_object_add().

3 years agoDon't export json-c symbols starting with an underscore, put deprecated exports into...
Eric Haszlakiewicz [Sat, 4 Jul 2020 18:58:56 +0000 (18:58 +0000)]
Don't export json-c symbols starting with an underscore, put deprecated exports into a "JSONC_PRIVATE" version, and note stuff to do during releases.
See also PR #639 and issue #621

3 years agoChange the strerror_override handling to check $_JSON_C_STRERROR_OVERRIDE instead...
Eric Haszlakiewicz [Sat, 4 Jul 2020 18:56:15 +0000 (18:56 +0000)]
Change the strerror_override handling to check $_JSON_C_STRERROR_OVERRIDE instead of using a variable, so we don't need to export it.

3 years agoMerge pull request #639 from smcv/symbol-versions
Eric Hawicz [Sat, 4 Jul 2020 18:26:20 +0000 (14:26 -0400)]
Merge pull request #639 from smcv/symbol-versions

build: Add a symbol version to all exported symbols

3 years agobuild: Add symbol versions to all exported symbols
Simon McVittie [Mon, 29 Jun 2020 17:16:34 +0000 (18:16 +0100)]
build: Add symbol versions to all exported symbols

With this version script, newly-linked binaries that depend on the
json-c shared library will refer to its symbols in a versioned form,
preventing their references from being resolved to a symbol of the same
name exported by json-glib or libjansson if those libraries appear in
dependency search order before json-c, which will usually result in
a crash. This is necessary because ELF symbol resolution normally uses
a single flat namespace, not a tree like Windows symbol resolution.
At least one symbol (json_object_iter_next()) is exported by all three
JSON libraries.

Linking with -Bsymbolic is not enough to have this effect in all cases,
because -Bsymbolic only affects symbol lookup within a shared object,
for example when json_object_set_serializer() calls
json_object_set_userdata(). It does not affect calls from external
code into json-c, unless json-c was statically linked into the
external caller.

This change will also not prevent code that depends on json-glib or
libjansson from finding json-c's symbols and crashing; to prevent
that, a corresponding change in json-glib or libjansson would be needed.

Adding a symbol-version is a backwards-compatible change, but once
added, removing or changing the symbol-version on a symbol would be an
incompatible change that requires a SONAME bump.

Resolves: https://github.com/json-c/json-c/issues/621
(when combined with an equivalent change to libjansson).

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoUse constants referring to the signed integer types when setting SSIZE_T_MAX.
Eric Haszlakiewicz [Wed, 1 Jul 2020 00:34:46 +0000 (00:34 +0000)]
Use constants referring to the signed integer types when setting SSIZE_T_MAX.
In practice, the sizes of the signed and unsigned integer types will
almost cetainly be the same, but this is more correct.
Pointed out in issue #638.

3 years agoReplace one call to json_object_new_array() with json_object_new_array_ext() to ensur...
Eric Haszlakiewicz [Mon, 29 Jun 2020 02:35:26 +0000 (02:35 +0000)]
Replace one call to json_object_new_array() with json_object_new_array_ext() to ensure it at least minimally works.

3 years agoAdd doc comment for json_object_new_array_ext().
Eric Haszlakiewicz [Mon, 29 Jun 2020 02:31:32 +0000 (02:31 +0000)]
Add doc comment for json_object_new_array_ext().

3 years agoFix code formatting
Eric Haszlakiewicz [Mon, 29 Jun 2020 02:31:18 +0000 (02:31 +0000)]
Fix code formatting

3 years agoMake sure TEST_PARSE_CHUNKSIZE is valid if it's set.
Eric Haszlakiewicz [Mon, 29 Jun 2020 02:18:34 +0000 (02:18 +0000)]
Make sure TEST_PARSE_CHUNKSIZE is valid if it's set.

3 years agoIn the json_tokener_state_number case, explicitly adjust what "number" characters...
Eric Haszlakiewicz [Mon, 29 Jun 2020 02:14:26 +0000 (02:14 +0000)]
In the json_tokener_state_number case, explicitly adjust what "number" characters are allowed based on the exact micro-state that we're in, and check for invalid following characters in a different way, to allow a valid json_type_number object to be returned at the top level.
This causes previously failing strings like "123-456" to return a valid json_object with the appropriate value.  If you care about the trailing content, call json_tokener_parse_ex() and check the parse end point with json_tokener_get_parse_end().

3 years agoFix incremental parsing of invalid numbers with exponents, such as "0e+-" and "12...
Eric Haszlakiewicz [Sat, 27 Jun 2020 15:32:19 +0000 (15:32 +0000)]
Fix incremental parsing of invalid numbers with exponents, such as "0e+-" and "12.3E12E12", while still allowing "0e+" in non-strict mode.
Deprecate the json_parse_double() function from json_util.h

3 years agoIssue #635: Fix "expression has no effect" warning in json_tokener.c by casting to...
Eric Haszlakiewicz [Tue, 23 Jun 2020 02:51:46 +0000 (02:51 +0000)]
Issue #635: Fix "expression has no effect" warning in json_tokener.c by casting to void.

3 years agoFix memory leak in test_parse's single_incremental_parse().
Eric Haszlakiewicz [Mon, 22 Jun 2020 01:12:03 +0000 (01:12 +0000)]
Fix memory leak in test_parse's single_incremental_parse().

3 years agoDrop extra blank lines from arraylist.h
Eric Haszlakiewicz [Sun, 21 Jun 2020 18:30:40 +0000 (18:30 +0000)]
Drop extra blank lines from arraylist.h

3 years agoIssue #616: Change the parsing of surrogate pairs in unicode escapes so it uses a...
Eric Haszlakiewicz [Sun, 21 Jun 2020 18:17:40 +0000 (18:17 +0000)]
Issue #616: Change the parsing of surrogate pairs in unicode escapes so it uses a couple of additional states instead of assuming the low surrogate is already present, to ensure that we correctly handle various cases of incremental parsing.

3 years agoIn test_parse, fix lengths passed during a couple of incremental tests.
Eric Haszlakiewicz [Sun, 21 Jun 2020 17:36:38 +0000 (17:36 +0000)]
In test_parse, fix lengths passed during a couple of incremental tests.
Add an optional way to use an incremental chunk size ($TEST_PARSE_CHUNKSIZE)
for all of the single_basic_parse tests, in additional to the regular way.

3 years agoRearrange the json_tokener_state_escape_unicode case in json_tokener to simplify...
Eric Haszlakiewicz [Sun, 21 Jun 2020 03:10:55 +0000 (03:10 +0000)]
Rearrange the json_tokener_state_escape_unicode case in json_tokener to simplify the code slightly and make it a bit easier to understand.
While here, drop the utf8_replacement_char that is unnecesarily added if we run out of input in the middle of a unicode escape.  No other functional changes (yet).

3 years agoUpdate the json_tokener_parse_ex() docs to clarify that the final '\0' character...
Eric Haszlakiewicz [Sun, 21 Jun 2020 02:35:42 +0000 (02:35 +0000)]
Update the json_tokener_parse_ex() docs to clarify that the final '\0' character is to be included in length passed in.

3 years agoMerge pull request #633 from dota17/issue616
Eric Hawicz [Sun, 21 Jun 2020 02:33:17 +0000 (22:33 -0400)]
Merge pull request #633 from dota17/issue616

fix issue 616: support the surrogate pair in split file.

3 years agoAdd json_object_array_shrink() (and array_list_shrink()) and use it in json_tokener...
Eric Haszlakiewicz [Sat, 20 Jun 2020 18:03:04 +0000 (18:03 +0000)]
Add json_object_array_shrink() (and array_list_shrink()) and use it in json_tokener to minimize the amount of memory used.  This results in a 39%-50% reduction in memory use (peak RSS, peak heap usage) on the jc-bench benchmark and 9% shorter runtime.
Also add the json_object_new_array_ext, array_list_new2, and array_list_shrink functions.

3 years agoMerge pull request #632 from json-c/json_object-split
Eric Hawicz [Sat, 20 Jun 2020 17:04:32 +0000 (13:04 -0400)]
Merge pull request #632 from json-c/json_object-split

Json object split

3 years agoReformat the json_object-split branch with clang-format json_object-split
Eric Haszlakiewicz [Tue, 16 Jun 2020 13:17:58 +0000 (13:17 +0000)]
Reformat the json_object-split branch with clang-format

3 years agoMerge pull request #634 from micahsnyder/json-c-fPIC
Eric Hawicz [Sun, 14 Jun 2020 21:56:35 +0000 (17:56 -0400)]
Merge pull request #634 from micahsnyder/json-c-fPIC

Issue #508: `-fPIC` to link libjson-c.a with libs

3 years agoIssue #508: `-fPIC` to link libjson-c.a with libs
Micah Snyder [Sun, 14 Jun 2020 16:01:48 +0000 (12:01 -0400)]
Issue #508: `-fPIC` to link libjson-c.a with libs

json-c has symbol collisions with other popular C JSON libraries.
To prevent random crashes in downstream applications that may use a
library which depends on json-c, the solution is to statically link
libjson-c.a into those libraries.

`-fPIC`/`-fPIE` is required when building a `.a` so it can be linked
into a `.so`.

3 years agoInclude unistd.h to fix the build on OSX
Eric Haszlakiewicz [Sun, 14 Jun 2020 03:11:44 +0000 (03:11 +0000)]
Include unistd.h to fix the build on OSX

3 years agoDrop the _delete field from struct json_object and call the type-specific delete...
Eric Haszlakiewicz [Sat, 13 Jun 2020 18:34:35 +0000 (18:34 +0000)]
Drop the _delete field from struct json_object and call the type-specific delete functions directly from json_object_put.  (Thanks @dota17 for the suggestion in PR #632!)

3 years agoDrop the useless "char data[1]" from struct json_object. Fix a typo in a comment.
Eric Haszlakiewicz [Sat, 13 Jun 2020 18:25:32 +0000 (18:25 +0000)]
Drop the useless "char data[1]" from struct json_object.  Fix a typo in a comment.

3 years agofix issue 616: support the surrogate pair in split file.
dota17 [Tue, 2 Jun 2020 11:17:42 +0000 (19:17 +0800)]
fix issue 616: support the surrogate pair in split file.

3 years agoEliminate unnecessary cast that was added to test_double_serializer.
Eric Haszlakiewicz [Sun, 7 Jun 2020 18:50:10 +0000 (18:50 +0000)]
Eliminate unnecessary cast that was added to test_double_serializer.

3 years agoSummarize the changes from the json_object-split branch in the ChangeLog.
Eric Haszlakiewicz [Sun, 7 Jun 2020 18:45:17 +0000 (18:45 +0000)]
Summarize the changes from the json_object-split branch in the ChangeLog.

3 years agoMove the ssize_t typedef from json_inttypes.h to json_object_private.h so as not...
Eric Haszlakiewicz [Sun, 7 Jun 2020 18:29:56 +0000 (18:29 +0000)]
Move the ssize_t typedef from json_inttypes.h to json_object_private.h so as not to affect publically exposed symbols.

3 years agoThe split of json_object into type-specific sub-structures is now functionally complete.
Eric Haszlakiewicz [Sun, 7 Jun 2020 03:30:39 +0000 (03:30 +0000)]
The split of json_object into type-specific sub-structures is now functionally complete.
Remove all of the temporary defines, structures, old compat fuctions, extra fields, etc... that were needed during the conversion to a split set of json_object_* structures.

3 years agoMore fixes for old MSVC builds.
Eric Haszlakiewicz [Sun, 7 Jun 2020 15:25:59 +0000 (15:25 +0000)]
More fixes for old MSVC builds.

3 years agoFix typo in previous commit to check for SSIZE_T on MSVC.
Eric Haszlakiewicz [Sun, 7 Jun 2020 15:19:29 +0000 (15:19 +0000)]
Fix typo in previous commit to check for SSIZE_T on MSVC.

3 years agoChange CMakeLists.txt to look for SSIZE_T on MSVC too.
Eric Haszlakiewicz [Sun, 7 Jun 2020 03:36:59 +0000 (03:36 +0000)]
Change CMakeLists.txt to look for SSIZE_T on MSVC too.

3 years agoOn MSVC, add a ssize_t typedef using SSIZE_T from BaseTsd.h
Eric Haszlakiewicz [Sun, 7 Jun 2020 03:27:13 +0000 (03:27 +0000)]
On MSVC, add a ssize_t typedef using SSIZE_T from BaseTsd.h

3 years agoKick json_type_string out of struct json_object.
Eric Haszlakiewicz [Sun, 7 Jun 2020 02:42:58 +0000 (02:42 +0000)]
Kick json_type_string out of struct json_object.
The default is now that string data is stored inline at the end of json_object, though to allow for json_object_set_string() to set a _longer_ string, we still need to allow for the possibility of a separate char * pointer.
All json types have been split out now, next step it cleanup.

3 years agoMerge pull request #628 from clamwin/compat-fixes-master
Eric Hawicz [Thu, 4 Jun 2020 03:53:46 +0000 (23:53 -0400)]
Merge pull request #628 from clamwin/compat-fixes-master

get_cryptgenrandom_seed: compat with old windows + fallback

3 years agoget_cryptgenrandom_seed: compat with old windows + fallback
Gianluigi Tiesi [Mon, 1 Jun 2020 18:49:08 +0000 (20:49 +0200)]
get_cryptgenrandom_seed: compat with old windows + fallback

3 years agoApply the fix from @pointbre in issue #626 to skip "inline" on AIX, but invert the...
Eric Haszlakiewicz [Sun, 31 May 2020 03:22:14 +0000 (03:22 +0000)]
Apply the fix from @pointbre in issue #626 to skip "inline" on AIX, but invert the test to make it a little easier to understand.

3 years agoIssue #626: Restore compatibility with cmake 2.8 by adjusting quoting and explicitly...
Eric Haszlakiewicz [Sat, 30 May 2020 19:36:54 +0000 (19:36 +0000)]
Issue #626: Restore compatibility with cmake 2.8 by adjusting quoting and explicitly defining the PROJECT_VERSION* variables.

3 years agoKick json_type_int and json_type_double out of struct json_object.
Eric Haszlakiewicz [Tue, 26 May 2020 02:31:35 +0000 (02:31 +0000)]
Kick json_type_int and json_type_double out of struct json_object.
Clean up the code in json_object_new_* a bit by dropping unnecesary json_object_base variables.

3 years agoDeclare variables earlier, to appease Visual Studio 2010.
Eric Haszlakiewicz [Mon, 25 May 2020 04:10:11 +0000 (04:10 +0000)]
Declare variables earlier, to appease Visual Studio 2010.

3 years agoKick json_type_boolean out of struct json_object.
Eric Haszlakiewicz [Mon, 25 May 2020 04:04:02 +0000 (04:04 +0000)]
Kick json_type_boolean out of struct json_object.

3 years agoAdd some backwards compat for Visual Studio 2013.
Eric Haszlakiewicz [Mon, 25 May 2020 03:52:36 +0000 (03:52 +0000)]
Add some backwards compat for Visual Studio 2013.

3 years agoKick json_type_array out of struct json_object; re-enable the test_deep_copy test.
Eric Haszlakiewicz [Mon, 25 May 2020 03:44:56 +0000 (03:44 +0000)]
Kick json_type_array out of struct json_object; re-enable the test_deep_copy test.

3 years agoStart splitting struct json_object into multiple sub-types, as descibed at https...
Eric Haszlakiewicz [Mon, 25 May 2020 03:14:06 +0000 (03:14 +0000)]
Start splitting struct json_object into multiple sub-types, as descibed at https://github.com/json-c/json-c/wiki/Proposal:-struct-json_object-split
The current changes split out _only_ json_type_object, and thus have a number of hacks
 to allow the code to continue to build and work.

Originally  mentioned in issue #535.
When complete, this will probably invalidate #552.
This is likely to cause notable conflicts in any other significant un-merged
changes, such as PR#620.

3 years agoIn arraylist, use malloc instead of calloc, avoid clearing with memeset until we...
Eric Haszlakiewicz [Sun, 24 May 2020 03:53:32 +0000 (03:53 +0000)]
In arraylist, use malloc instead of calloc, avoid clearing with memeset until we really need to, and micro-optimize array_list_add().

4 years agoMerge pull request #622 from besser82/topic/besser82/doc_subdir
Eric Hawicz [Mon, 18 May 2020 19:30:21 +0000 (15:30 -0400)]
Merge pull request #622 from besser82/topic/besser82/doc_subdir

doc: Move Doxyfile into doc subdir.

4 years agoCMake: Fix grammar: written -> wrote.
Björn Esser [Mon, 18 May 2020 18:36:05 +0000 (20:36 +0200)]
CMake: Fix grammar: written -> wrote.

4 years agodoc: Move Doxyfile into doc subdir
Björn Esser [Mon, 18 May 2020 18:32:35 +0000 (20:32 +0200)]
doc: Move Doxyfile into doc subdir

4 years agoWith the change in cc80203, Doxyfile no longer needs to be updated for a release.
Eric Haszlakiewicz [Mon, 18 May 2020 17:31:22 +0000 (17:31 +0000)]
With the change in cc80203, Doxyfile no longer needs to be updated for a release.

4 years agoMerge pull request #619 from besser82/topic/besser82/doxygen_oot
Eric Hawicz [Mon, 18 May 2020 17:30:13 +0000 (13:30 -0400)]
Merge pull request #619 from besser82/topic/besser82/doxygen_oot

CMake: Fix out-of-tree build for Doxygen documentation.

4 years agoMerge pull request #618 from besser82/topic/besser82/test_deep_copy
Eric Hawicz [Mon, 18 May 2020 17:29:21 +0000 (13:29 -0400)]
Merge pull request #618 from besser82/topic/besser82/test_deep_copy

test_deep_copy: Fix assertion value.

4 years agoCMake: Fix out-of-tree build for Doxygen documentation.
Björn Esser [Mon, 18 May 2020 16:20:01 +0000 (18:20 +0200)]
CMake: Fix out-of-tree build for Doxygen documentation.

4 years agotest_deep_copy: Fix assertion value.
Björn Esser [Mon, 18 May 2020 15:00:17 +0000 (17:00 +0200)]
test_deep_copy: Fix assertion value.

4 years agoMerge pull request #617 from besser82/topic/besser82/option_disable_tls
Eric Hawicz [Mon, 18 May 2020 14:25:54 +0000 (10:25 -0400)]
Merge pull request #617 from besser82/topic/besser82/option_disable_tls

Add an option to disable the use of thread-local storage.

4 years agoREADME: Update configuration options for CMake.
Björn Esser [Mon, 18 May 2020 10:39:38 +0000 (12:39 +0200)]
README: Update configuration options for CMake.

4 years agoCMake: Re-format config-option block and re-order it alphabetically.
Björn Esser [Mon, 18 May 2020 10:26:47 +0000 (12:26 +0200)]
CMake: Re-format config-option block and re-order it alphabetically.

4 years agoCMake: Add an option to disable the use of thread-local storage.
Björn Esser [Mon, 18 May 2020 09:38:58 +0000 (11:38 +0200)]
CMake: Add an option to disable the use of thread-local storage.

Using thread-local storage may not be desired in all environments
and/or use-cases, thus there should be an option to disable its use
on purpose.

Fixes #451.

4 years agotests: Fix test_double_serializer without thread-local storage.
Björn Esser [Mon, 18 May 2020 09:38:36 +0000 (11:38 +0200)]
tests: Fix test_double_serializer without thread-local storage.

4 years agoMerge pull request #614 from stoeckmann/format
Eric Hawicz [Sun, 17 May 2020 01:04:11 +0000 (21:04 -0400)]
Merge pull request #614 from stoeckmann/format

Prevent truncation on custom double formatters.

4 years agoUpdate issue templates
Eric Hawicz [Sun, 17 May 2020 00:55:20 +0000 (20:55 -0400)]
Update issue templates

4 years agoPrevent truncation on custom double formatters.
Tobias Stoeckmann [Sat, 16 May 2020 11:01:10 +0000 (13:01 +0200)]
Prevent truncation on custom double formatters.

A custom double formatter can lead to truncation of the rest of the
JSON document.

If a custom formatter completely fills the buffer used by snprintf
with a trailing dot or comma and the formatting option
JSON_C_TO_STRING_NOZERO has been specified, then an iterator moves
past the ending '\0' (off-by-one buffer overflow) to set an
additional '\0' and adds the first '\0' into the printbuf.

Since '\0' will eventually be considered the terminating character
of the complete printbuf result, all trailing characters are lost.

This leads to an incomplete JSON string as can be seen with the
test case.

The off-by-one can be noticed if compiled with address sanitizer.

Since this is a very special case and a malformed formatter could
do way more harm and is the responsibility of the user of this
library, this is just a protective measure to keep json-c code as
robust as possible.

4 years agoRevert part of PR#606 and use isnan/isinf again, but provide macro implementations...
Eric Haszlakiewicz [Sat, 16 May 2020 01:29:18 +0000 (01:29 +0000)]
Revert part of PR#606 and use isnan/isinf again, but provide macro implementations of those in math_compat.h is needed, as it seems to be on AIX and IBM i systems.

4 years agoMerge pull request #606 from davidjmccann/master
Eric Hawicz [Sat, 16 May 2020 01:15:18 +0000 (21:15 -0400)]
Merge pull request #606 from davidjmccann/master

Improved support for IBM operating systems

4 years agoImproved support for IBM operating systems
David McCann [Wed, 13 May 2020 14:57:54 +0000 (15:57 +0100)]
Improved support for IBM operating systems

Fix compiler errors and warnings when building on IBM operating systems such as AIX and IBM i.

4 years agoIssue #604: add check for __MINGW32__ in snprintf_compat.h
Eric Haszlakiewicz [Wed, 13 May 2020 14:53:05 +0000 (14:53 +0000)]
Issue #604: add check for __MINGW32__ in snprintf_compat.h

4 years agoDisplay a bit of info about what exactly we're benchmarking.
Eric Haszlakiewicz [Mon, 11 May 2020 03:03:43 +0000 (03:03 +0000)]
Display a bit of info about what exactly we're benchmarking.

4 years agoIgnore the bench/work and bench/data directories.
Eric Haszlakiewicz [Mon, 11 May 2020 01:24:46 +0000 (01:24 +0000)]
Ignore the bench/work and bench/data directories.

4 years agoMerge pull request #602 from ploxiln/parse_uint64_errno
Eric Hawicz [Mon, 11 May 2020 01:15:47 +0000 (21:15 -0400)]
Merge pull request #602 from ploxiln/parse_uint64_errno

fix json_parse_uint64() usage of errno

4 years agofix json_parse_uint64() usage of errno
Pierce Lopez [Sun, 10 May 2020 17:20:02 +0000 (13:20 -0400)]
fix json_parse_uint64() usage of errno

introduced in #542
fixes #601

4 years agoFix snprintf on windows problem for test4.
Eric Haszlakiewicz [Sun, 10 May 2020 04:04:28 +0000 (04:04 +0000)]
Fix snprintf on windows problem for test4.

4 years agoIssue #600: don't rename the static library on Windows, it _needs_ to have a differen...
Eric Haszlakiewicz [Sun, 10 May 2020 03:58:51 +0000 (03:58 +0000)]
Issue #600: don't rename the static library on Windows, it _needs_ to have a different name because the dll build also creates a "json-c.lib" file.

4 years agoRe-format after recent change to fix linkhash.
Eric Haszlakiewicz [Sun, 10 May 2020 03:58:27 +0000 (03:58 +0000)]
Re-format after recent change to fix linkhash.

4 years agoIssue #598: avoid building static libraries twice.
Eric Haszlakiewicz [Sun, 10 May 2020 03:48:45 +0000 (03:48 +0000)]
Issue #598: avoid building static libraries twice.

4 years agoIssue #599: Fix the backwards check in lh_table_insert_w_hash() that was preventing...
Eric Haszlakiewicz [Sun, 10 May 2020 03:32:19 +0000 (03:32 +0000)]
Issue #599: Fix the backwards check in lh_table_insert_w_hash() that was preventing adding more than 11 objects.
Add a test to check for this too.

4 years agoMerge branch 'master' of https://github.com/json-c/json-c
Eric Hawicz [Sat, 9 May 2020 02:25:15 +0000 (22:25 -0400)]
Merge branch 'master' of https://github.com/json-c/json-c

4 years agoMerge pull request #597 from ploxiln/json_parse_usage
Eric Hawicz [Sat, 9 May 2020 02:23:28 +0000 (22:23 -0400)]
Merge pull request #597 from ploxiln/json_parse_usage

json_parse demo: fix and use usage() function

4 years agojson_parse demo: fix and use usage() function
Pierce Lopez [Fri, 8 May 2020 22:27:35 +0000 (18:27 -0400)]
json_parse demo: fix and use usage() function

4 years agoMerge pull request #595 from dota17/static_shared
Eric Hawicz [Fri, 8 May 2020 03:23:15 +0000 (23:23 -0400)]
Merge pull request #595 from dota17/static_shared

Support to build both static and shared libraries

4 years agocmake-configure: fix enable-static option
hofnarr [Thu, 7 May 2020 23:27:06 +0000 (02:27 +0300)]
cmake-configure: fix enable-static option

4 years agocmake: change variable name
hofnarr [Thu, 7 May 2020 23:19:38 +0000 (02:19 +0300)]
cmake: change variable name