]> granicus.if.org Git - json-c/log
json-c
7 years agoIssue #173, follow up to using strtoll to allow this to work on older Windows environ...
Eric Haszlakiewicz [Wed, 4 Oct 2017 02:50:29 +0000 (22:50 -0400)]
Issue #173, follow up to using strtoll to allow this to work on older Windows environments: Use cmake to generate config.h from config.h.win32, including checking for strtoll with cmake, or fall back to _strtoi64 for older MSVC's.
Also, add a few missing files to the list of sources to build.

7 years agoThe new cmake-generated VS builds now generate a dynamic .dll instead of a .lib
Eric Haszlakiewicz [Mon, 18 Sep 2017 01:44:04 +0000 (21:44 -0400)]
The new cmake-generated VS builds now generate a dynamic .dll instead of a .lib

7 years agoFor appveyor builds, json_config.h is actually generated in the "include" directory.
Eric Haszlakiewicz [Mon, 18 Sep 2017 01:35:53 +0000 (21:35 -0400)]
For appveyor builds, json_config.h is actually generated in the "include" directory.

7 years agoSplit the list of cmake headers into public and private ones, and only install the...
Eric Haszlakiewicz [Mon, 18 Sep 2017 01:27:07 +0000 (21:27 -0400)]
Split the list of cmake headers into public and private ones, and only install the public ones.

7 years agoAdd a "cmake ." line to the appveyor build file to try to get it working again.
Eric Haszlakiewicz [Mon, 18 Sep 2017 01:25:49 +0000 (21:25 -0400)]
Add a "cmake ." line to the appveyor build file to try to get it working again.

7 years agoMerge pull request #361 from schwehr/int64
Eric Haszlakiewicz [Tue, 12 Sep 2017 01:25:27 +0000 (21:25 -0400)]
Merge pull request #361 from schwehr/int64

Fix double to int cast overflow in json_object_get_int64.

7 years agoFix double to int cast overflow in json_object_get_int64.
Kurt Schwehr [Mon, 11 Sep 2017 14:23:00 +0000 (07:23 -0700)]
Fix double to int cast overflow in json_object_get_int64.

Found with autofuzz in GDAL

7 years agoMerge pull request #360 from jasonbking/master
Eric Haszlakiewicz [Fri, 8 Sep 2017 02:45:48 +0000 (22:45 -0400)]
Merge pull request #360 from jasonbking/master

Use strtoll() to parse ints

7 years agoIssue#353: attempt to fix or ignore a few -Wdocumentation messages from Clang.
Eric Haszlakiewicz [Fri, 8 Sep 2017 02:22:25 +0000 (22:22 -0400)]
Issue#353: attempt to fix or ignore a few -Wdocumentation messages from Clang.

7 years agoIssue#353: mark lh_abort as actually deprecated, not just in the docs.
Eric Haszlakiewicz [Fri, 8 Sep 2017 02:21:29 +0000 (22:21 -0400)]
Issue#353: mark lh_abort as actually deprecated, not just in the docs.

7 years agoAdd long long 64-bit check
Jason King [Fri, 8 Sep 2017 01:46:06 +0000 (01:46 +0000)]
Add long long 64-bit check

7 years agoUse strtoll to parse ints
Jason King [Thu, 7 Sep 2017 17:21:14 +0000 (17:21 +0000)]
Use strtoll to parse ints

7 years agoRemove the Visual Studio project files as they were out of date, and should now be...
Eric Haszlakiewicz [Thu, 7 Sep 2017 03:50:03 +0000 (23:50 -0400)]
Remove the Visual Studio project files as they were out of date, and should now be generated by using cmake.

7 years agoIssue #359: Use consistent spacing in CMakeLists.txt
Eric Haszlakiewicz [Thu, 7 Sep 2017 03:40:20 +0000 (23:40 -0400)]
Issue #359: Use consistent spacing in CMakeLists.txt

7 years agoIssue #359: Don't duplicate lh_get_hash, just omit the "inline" for VS2010.
Eric Haszlakiewicz [Thu, 7 Sep 2017 03:39:23 +0000 (23:39 -0400)]
Issue #359: Don't duplicate lh_get_hash, just omit the "inline" for VS2010.

7 years agoMerge pull request #359 from Haffon/api-0.12
Eric Haszlakiewicz [Thu, 7 Sep 2017 03:20:36 +0000 (23:20 -0400)]
Merge pull request #359 from Haffon/api-0.12

update CMakeLists.txt for compile with visual studio at least 2010

7 years agoset JSON_C_HEADERS full file name
Haffon [Thu, 7 Sep 2017 02:39:14 +0000 (10:39 +0800)]
set JSON_C_HEADERS full file name

7 years agoif compile with vs2015, enable the "static inline" declare.
Haffon [Thu, 7 Sep 2017 02:28:26 +0000 (10:28 +0800)]
if compile with vs2015, enable the "static inline" declare.

7 years agorollback api to 0.12
Haffon [Thu, 7 Sep 2017 02:02:21 +0000 (10:02 +0800)]
rollback api to 0.12

7 years agoMerge pull request #2 from json-c/master
Haffon [Thu, 7 Sep 2017 01:33:07 +0000 (09:33 +0800)]
Merge pull request #2 from json-c/master

merge upstream

7 years agoUndo a bit of 2d1da5ab: handle per-thread formats for double serialization, even...
Eric Haszlakiewicz [Tue, 5 Sep 2017 05:56:42 +0000 (01:56 -0400)]
Undo a bit of 2d1da5ab: handle per-thread formats for double serialization, even if --enable-threading wasn't specified.

7 years agoIssue #173: since some sscanf implementations return 0 for non-zero inputs, directly...
Eric Haszlakiewicz [Tue, 5 Sep 2017 05:53:13 +0000 (01:53 -0400)]
Issue #173: since some sscanf implementations return 0 for non-zero inputs, directly check for "0" in the input.

7 years agoAdd a --enable-threading configure option, and only use the (slower) __sync_add_and_f...
Eric Haszlakiewicz [Mon, 4 Sep 2017 03:37:12 +0000 (23:37 -0400)]
Add a --enable-threading configure option, and only use the (slower) __sync_add_and_fetch()/__sync_sub_and_fetch() function when it is specified.

7 years agoUse AC_CONFIG_MACRO_DIRS to specify path to the ax macros instead of passing -I to...
Eric Haszlakiewicz [Mon, 4 Sep 2017 02:35:58 +0000 (22:35 -0400)]
Use AC_CONFIG_MACRO_DIRS to specify path to the ax macros instead of passing -I to autoreconf in autogen.sh.

7 years agoExplicitly check for GCC's atomic functions instead of depending on the __GNUC__...
Eric Haszlakiewicz [Sat, 2 Sep 2017 18:48:17 +0000 (14:48 -0400)]
Explicitly check for GCC's atomic functions instead of depending on the __GNUC__ define.
Add a comment mentioning the limitation even though the _ref_count value is hanled atomically.

7 years agoMerge branch 'pull-211'
Eric Haszlakiewicz [Sat, 2 Sep 2017 17:54:15 +0000 (13:54 -0400)]
Merge branch 'pull-211'
This is EmielBruijntes' "Atomic updates for the refcount"

7 years agoIssue #351: don't redefine SIZE_T_MAX if it's already defined.
Eric Haszlakiewicz [Thu, 31 Aug 2017 03:35:56 +0000 (23:35 -0400)]
Issue #351: don't redefine SIZE_T_MAX if it's already defined.

7 years agoIssue #349: none of automake's clean targets are suite for really cleaning up everyth...
Eric Haszlakiewicz [Thu, 31 Aug 2017 03:17:24 +0000 (23:17 -0400)]
Issue #349: none of automake's clean targets are suite for really cleaning up everything, so add a local "really-clean" target that does so.

7 years agoMerge pull request #1 from json-c/master
Haffon [Tue, 29 Aug 2017 16:02:59 +0000 (00:02 +0800)]
Merge pull request #1 from json-c/master

want to merge the original repository

7 years agoPR#331: for Visual Studio, use a snprintf/vsnprintf wrapper that ensures the string...
Eric Haszlakiewicz [Fri, 25 Aug 2017 05:15:39 +0000 (01:15 -0400)]
PR#331: for Visual Studio, use a snprintf/vsnprintf wrapper that ensures the string is terminated.

7 years ago1.make it can been compiled with Visual Studio 2010
Haffon [Tue, 22 Aug 2017 05:53:47 +0000 (13:53 +0800)]
1.make it can been compiled with Visual Studio 2010
2.replace json_object_get/put API with json_object_retain/release, as they operate the reference counter, and confused with array_list_get/put_idx.
3.replace array_list_get/put_idx API with array_list_get/insert to make them more clear to use.

7 years agoMerge pull request #346 from schwehr/get_int
Eric Haszlakiewicz [Tue, 22 Aug 2017 01:50:58 +0000 (20:50 -0500)]
Merge pull request #346 from schwehr/get_int

Clamp double to int32 when narrowing in json_object_get_int.

7 years agoMerge pull request #345 from MrAnno/fix-make-dist
Eric Haszlakiewicz [Tue, 22 Aug 2017 01:50:20 +0000 (20:50 -0500)]
Merge pull request #345 from MrAnno/fix-make-dist

Fix make dist and make distcheck

7 years agoMerge pull request #344 from fastogt/master
Eric Haszlakiewicz [Tue, 22 Aug 2017 01:39:11 +0000 (20:39 -0500)]
Merge pull request #344 from fastogt/master

Fix Mingw build

7 years agoClamp double to int32 when narrowing in json_object_get_int.
Kurt Schwehr [Tue, 8 Aug 2017 14:54:38 +0000 (07:54 -0700)]
Clamp double to int32 when narrowing in json_object_get_int.

Avoids undefined behavior.  Found by autofuzz.

7 years agoFix 'make distcheck'
László Várady [Fri, 4 Aug 2017 10:26:54 +0000 (12:26 +0200)]
Fix 'make distcheck'

Signed-off-by: László Várady <laszlo.varady@balabit.com>
7 years agoFix 'make dist'
László Várady [Fri, 4 Aug 2017 09:59:14 +0000 (11:59 +0200)]
Fix 'make dist'

EXTRA_DIST copies the listed directories/files from the _source_ directory
into the distribution.

Since the doc directory does not exist after running autogen + configure
+ make dist, the distribution tarball generation fails.

Note that the dist-hook rule below operates on 'distdir', not on the source
directory where EXTRA_DIST expects the existence of the doc folder.

In summary, even if I removed 'doc' from EXTRA_DIST, the dist tarball will
always contain the documentation (due to the dist-hook rule).

Signed-off-by: László Várady <laszlo.varady@balabit.com>
7 years agoFix Mingw build
topilski [Sun, 30 Jul 2017 04:37:17 +0000 (07:37 +0300)]
Fix Mingw build

7 years agoFix parsing doubles for mingw
topilski [Sun, 30 Jul 2017 04:30:05 +0000 (07:30 +0300)]
Fix parsing doubles for mingw

7 years agoPR #336: fix to previous change, be sure to include string.h when we're using the...
Eric Haszlakiewicz [Fri, 28 Jul 2017 03:17:25 +0000 (20:17 -0700)]
PR #336: fix to previous change, be sure to include string.h when we're using the real strerror.

7 years agoPR #336: Fix typo in defining STRERROR_OVERRIDE_IMPL
Eric Haszlakiewicz [Fri, 28 Jul 2017 03:10:53 +0000 (20:10 -0700)]
PR #336: Fix typo in defining STRERROR_OVERRIDE_IMPL

7 years agoMerge pull request #340 from commodo/fix-appveyor-build
Eric Haszlakiewicz [Fri, 28 Jul 2017 03:09:12 +0000 (23:09 -0400)]
Merge pull request #340 from commodo/fix-appveyor-build

strerror_override: add extern "C" and JSON_EXPORT specifiers for Visual C++ compilers

7 years agobuild,travis: drop `-enable-strerror-override` argument (no longer exists)
Alexandru Ardelean [Wed, 19 Jul 2017 12:22:36 +0000 (15:22 +0300)]
build,travis: drop `-enable-strerror-override` argument (no longer exists)

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agostrerror_override: add extern "C" and JSON_EXPORT specifiers for Visual C++ compilers
Alexandru Ardelean [Wed, 19 Jul 2017 12:10:10 +0000 (15:10 +0300)]
strerror_override: add extern "C" and JSON_EXPORT specifiers for Visual C++ compilers

Fixes build on AppVeyor.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agoPR #336: since we can't use function overriding (due to problems with it on
Eric Haszlakiewicz [Sat, 15 Jul 2017 14:12:44 +0000 (07:12 -0700)]
PR #336: since we can't use function overriding (due to problems with it on
OSX) always include the _json_c_strerror function but only enable it with a flag
 during tests.

7 years agoPR #336: since we can't use function overriding (due to problems with it on OSX)...
Eric Haszlakiewicz [Sat, 15 Jul 2017 14:07:28 +0000 (07:07 -0700)]
PR #336: since we can't use function overriding (due to problems with it on OSX) always include the _json_c_strerror function but only enable it with a flag during tests.

7 years agoAllow USE_VALGRIND to be set to anything starting with 0, N or n to disable valgrind...
Eric Haszlakiewicz [Sat, 15 Jul 2017 14:03:18 +0000 (07:03 -0700)]
Allow USE_VALGRIND to be set to anything starting with 0, N or n to disable valgrind during tests.

7 years agoMerge pull request #336 from commodo/fix-tests
Eric Haszlakiewicz [Fri, 14 Jul 2017 02:39:01 +0000 (22:39 -0400)]
Merge pull request #336 from commodo/fix-tests

tests: fix tests in travis-ci.org

7 years agobuild,travis: enable strerror override option in build
Alexandru Ardelean [Thu, 13 Jul 2017 07:24:27 +0000 (10:24 +0300)]
build,travis: enable strerror override option in build

To get consistent output between Linux & OS X.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agobuild: make `strerror()` override-able
Alexandru Ardelean [Thu, 13 Jul 2017 07:11:15 +0000 (10:11 +0300)]
build: make `strerror()` override-able

If we want to override `strerror()` in libjson-c
to make tests consistent across platforms, we
need to do it build-wide as configure/build
option.

Apple linkers make it really hard to override functions
at link-time, and this seems to be locked down on travis-ci.org
[ for security reasons I assume ].
While I got it to work locally, it did not work
when running on travis.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agoconfigure.ac: check for `uselocale` function only on Linux platforms
Alexandru Ardelean [Thu, 13 Jul 2017 06:33:39 +0000 (09:33 +0300)]
configure.ac: check for `uselocale` function only on Linux platforms

On Apple this seems to fail the `test_locale` test,
which would imply that the `uselocale` function
does not behave as expected.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agotests: fix leak in `test_util_file` ; found by cppcheck
Alexandru Ardelean [Mon, 10 Jul 2017 15:00:41 +0000 (18:00 +0300)]
tests: fix leak in `test_util_file` ; found by cppcheck

Which now seems to fail the build.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agotravis,tests: run cppcheck only if it exists
Alexandru Ardelean [Mon, 10 Jul 2017 14:47:00 +0000 (17:47 +0300)]
travis,tests: run cppcheck only if it exists

ugh... seems cppcheck is not packaged for OS X
And `set -e` exposes this.

And also `cppcheck` seems to exit with non-zero
exit codes by default [even if errs found].

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agotests: compress test_utile_file with test_basic
Alexandru Ardelean [Mon, 10 Jul 2017 10:30:49 +0000 (13:30 +0300)]
tests: compress test_utile_file with test_basic

More code compression/de-duplication.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agotests: add `set -e` specifier to bail early on build run
Alexandru Ardelean [Mon, 10 Jul 2017 09:01:56 +0000 (12:01 +0300)]
tests: add `set -e` specifier to bail early on build run

Seems that test1 is failing, but travis is not catching it.
Likely, this is because the `cppcheck` returns success
and we need to bail on the `make check` step.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agoMerge pull request #335 from commodo/build_status_travis
Eric Haszlakiewicz [Tue, 11 Jul 2017 04:16:12 +0000 (00:16 -0400)]
Merge pull request #335 from commodo/build_status_travis

README.md: show build status tag from travis-ci.org

7 years agoREADME.md: show build status tag from travis & appveyor.
Alexandru Ardelean [Mon, 10 Jul 2017 08:28:10 +0000 (11:28 +0300)]
README.md: show build status tag from travis & appveyor.

Looks nice to see a `Build Passing` tag when you
scroll to the README.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agoMove a variable declaration to the start of the block to work better with older compi...
Eric Haszlakiewicz [Sun, 9 Jul 2017 23:08:29 +0000 (16:08 -0700)]
Move a variable declaration to the start of the block to work better with older compilers.

7 years agoRemove a spurious comma in configure.ac
Eric Haszlakiewicz [Sun, 9 Jul 2017 23:00:32 +0000 (16:00 -0700)]
Remove a spurious comma in configure.ac

7 years agoUpdated expected test1 output which should have been included in commit fd9b3b2.
Eric Haszlakiewicz [Sun, 9 Jul 2017 22:22:53 +0000 (15:22 -0700)]
Updated expected test1 output which should have been included in commit fd9b3b2.

7 years agoComment out the warning about racy random seed initialization in lh_char_hash(),...
Eric Haszlakiewicz [Sun, 9 Jul 2017 22:13:02 +0000 (15:13 -0700)]
Comment out the warning about racy random seed initialization in lh_char_hash(), if you're on a platform where it'll be triggered it just makes it a pain to build.

7 years agoAdd extra casts to void * to squash some warning on certain systems (e.g. CentOS...
Eric Haszlakiewicz [Sun, 9 Jul 2017 22:08:21 +0000 (15:08 -0700)]
Add extra casts to void * to squash some warning on certain systems (e.g. CentOS w/ gcc 4.1.2).

7 years agoFix bad usage of strncat introduces in 1a94c70. Pointed out by @rouault in PR #331.
Eric Haszlakiewicz [Sun, 9 Jul 2017 22:04:18 +0000 (15:04 -0700)]
Fix bad usage of strncat introduces in 1a94c70.  Pointed out by @rouault in PR #331.

7 years agoEliminate static qualifiers on a couple local variables that were causing thread...
Eric Haszlakiewicz [Sun, 9 Jul 2017 21:56:18 +0000 (14:56 -0700)]
Eliminate static qualifiers on a couple local variables that were causing thread safety issues.  Suggested by @rouault in PR #331.

7 years agoReformat json_object_double_to_json_string_format() to have consistent spacing.
Eric Haszlakiewicz [Sun, 9 Jul 2017 03:33:28 +0000 (20:33 -0700)]
Reformat json_object_double_to_json_string_format() to have consistent spacing.

7 years agoIssue #308: improve the build instructions in README.md to include the exact commands...
Eric Haszlakiewicz [Sun, 9 Jul 2017 02:35:06 +0000 (19:35 -0700)]
Issue #308: improve the build instructions in README.md to include the exact commands to run for installing prerequisites, as mentioned earlier on Issue #308.

7 years agoIssue #332: fix a long-standing bug in array_list_put_idx() where it would attempt...
Eric Haszlakiewicz [Sun, 9 Jul 2017 02:04:35 +0000 (19:04 -0700)]
Issue #332: fix a long-standing bug in array_list_put_idx() where it would attempt to free previously free'd entries due to not checking the current array length.
Add a test that triggers the problem to ensure it stays fixed.

7 years agoMerge pull request #312 from Tailmon/master
Eric Haszlakiewicz [Sun, 9 Jul 2017 01:25:48 +0000 (21:25 -0400)]
Merge pull request #312 from Tailmon/master

Fix CMake Build process improved for MinGW and MSYS2

7 years agoMerge pull request #319 from Dashlane/visual-studio-build
Eric Haszlakiewicz [Sun, 9 Jul 2017 01:24:55 +0000 (21:24 -0400)]
Merge pull request #319 from Dashlane/visual-studio-build

Windows: Fix dynamic library build with Visual Studio

7 years agoMerge pull request #329 from commodo/rename-static-lib
Eric Haszlakiewicz [Sat, 8 Jul 2017 19:44:27 +0000 (15:44 -0400)]
Merge pull request #329 from commodo/rename-static-lib

build,cmake: build,cmake: rename libjson-c-static.a to libjson-c.a

7 years agoMerge pull request #330 from commodo/symlink_some_tests
Eric Haszlakiewicz [Sat, 8 Jul 2017 19:43:45 +0000 (15:43 -0400)]
Merge pull request #330 from commodo/symlink_some_tests

tests: symlink basic tests to a single file that has the common code

7 years agoMerge pull request #333 from besser82/bugfix/obsolete_macros_autotools
Eric Haszlakiewicz [Sat, 8 Jul 2017 19:17:17 +0000 (15:17 -0400)]
Merge pull request #333 from besser82/bugfix/obsolete_macros_autotools

Replace obsolete AM_PROG_LIBTOOL

7 years agoReplace obsolete AM_PROG_LIBTOOL
Björn Esser [Mon, 3 Jul 2017 10:17:36 +0000 (12:17 +0200)]
Replace obsolete AM_PROG_LIBTOOL

7 years agotests: symlink basic tests to a single file that has the common code
Alexandru Ardelean [Thu, 22 Jun 2017 06:53:30 +0000 (09:53 +0300)]
tests: symlink basic tests to a single file that has the common code

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agobuild,cmake: set C_STANDARD 99 property to libjson-c-static
Alexandru Ardelean [Mon, 19 Jun 2017 15:12:03 +0000 (18:12 +0300)]
build,cmake: set C_STANDARD 99 property to libjson-c-static

Apply the same property as to json-c.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agobuild,cmake: rename libjson-c-static.a to libjson-c.a
Alexandru Ardelean [Mon, 19 Jun 2017 15:08:13 +0000 (18:08 +0300)]
build,cmake: rename libjson-c-static.a to libjson-c.a

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agoMerge pull request #321 from commodo/fix-cmake-vasprintf
Eric Haszlakiewicz [Mon, 19 Jun 2017 04:34:44 +0000 (00:34 -0400)]
Merge pull request #321 from commodo/fix-cmake-vasprintf

build,cmake: fix vasprintf implicit definition and generate both static & shared libs

7 years agoIssue #161: add a json_object_to_fd() function.
Eric Haszlakiewicz [Sun, 18 Jun 2017 18:44:45 +0000 (18:44 +0000)]
Issue #161: add a json_object_to_fd() function.

7 years agoFix test_double_serializer expected output.
Eric Haszlakiewicz [Sun, 18 Jun 2017 18:34:41 +0000 (18:34 +0000)]
Fix test_double_serializer expected output.

7 years agoAdd a json_c_set_serialization_double_format() function to set the *library-wide...
Eric Haszlakiewicz [Sun, 18 Jun 2017 18:04:49 +0000 (18:04 +0000)]
Add a json_c_set_serialization_double_format() function to set the *library-wide* format for how doubles are written to a serialized JSON output.

7 years agoMake _set_last_err() non-static so it can be used outside of json_util.c
Eric Haszlakiewicz [Sun, 4 Jun 2017 18:25:51 +0000 (18:25 +0000)]
Make _set_last_err() non-static so it can be used outside of json_util.c

7 years agoMerge pull request #325 from rouault/fix_stack_overflow_in_json_object_double_to_json...
Eric Haszlakiewicz [Mon, 22 May 2017 01:35:16 +0000 (21:35 -0400)]
Merge pull request #325 from rouault/fix_stack_overflow_in_json_object_double_to_json_string_format

Fix stack buffer overflow in json_object_double_to_json_string_format()

7 years agoFix stack buffer overflow in json_object_double_to_json_string_format()
Even Rouault [Thu, 18 May 2017 20:36:35 +0000 (22:36 +0200)]
Fix stack buffer overflow in json_object_double_to_json_string_format()

Issue originally found in the json-c 0.11 internal copy in GDAL but also found
in latest git version.

If doing things like
json_object* obj = json_object_new_double(1e300);
json_object_set_serializer(obj, json_object_double_to_json_string, "%f", NULL);
json_object_to_json_string(obj)

    size = snprintf(buf, sizeof(buf),
        format ? format :
          (modf(jso->o.c_double, &dummy) == 0) ? "%.17g.0" : "%.17g",
          jso->o.c_double);
will return a value greater than 128 since at least 300 characters are needed.
This value is then passed to printbuf_memappend(pb, buf, size); that tries to
read size bytes in buf.

So we should clamp size to sizeof(buf). And on Windows, _snprintf() returns -1
in that situation, so deal also with this case.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1682
Credit to OSS-Fuzz

7 years ago.gitignore: add cmake generated files
Alexandru Ardelean [Wed, 3 May 2017 08:30:38 +0000 (11:30 +0300)]
.gitignore: add cmake generated files

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agobuild,cmake: generate both static and shared libjson
Alexandru Ardelean [Wed, 3 May 2017 08:59:31 +0000 (11:59 +0300)]
build,cmake: generate both static and shared libjson

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agobuild,cmake: add _GNU_SOURCE to CFLAGS
Alexandru Ardelean [Wed, 3 May 2017 08:29:12 +0000 (11:29 +0300)]
build,cmake: add _GNU_SOURCE to CFLAGS

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years agoFix library build with Visual Studio
David Henot [Wed, 26 Apr 2017 12:08:31 +0000 (14:08 +0200)]
Fix library build with Visual Studio

7 years agoFixed linkhash.c for MinGW
Pablo Sanabria [Sat, 25 Mar 2017 22:18:29 +0000 (19:18 -0300)]
Fixed linkhash.c for MinGW

Added #ifdef conditions for MinGW because this compiler doesn't define
gcc atomic builtins, so __sync_val_compare_and_swap was not found
neither any of any __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* definition

7 years agoFix CMake Build process for MinGW and MSYS2
Pablo Sanabria [Sat, 25 Mar 2017 19:31:22 +0000 (16:31 -0300)]
Fix CMake Build process for MinGW and MSYS2

This fix includes some fixes for config.h.win32 that was generating
some compiling errors on MinGW64 and also fix CMakeLists.txt in order to
give better support to MinGW and MSYS2

7 years agoMerge pull request #311 from jj1118/master
Eric Haszlakiewicz [Sun, 26 Mar 2017 03:52:57 +0000 (03:52 +0000)]
Merge pull request #311 from jj1118/master

Fix error C3688 when compiling on Visual Studio 2015

7 years agoFix error C3688 when compiling on Visual Studio 2015: invalid literal suffix 'PRId64...
Jason Li [Fri, 24 Mar 2017 06:53:25 +0000 (14:53 +0800)]
Fix error C3688 when compiling on Visual Studio 2015: invalid literal suffix 'PRId64'; literal operator or literal operator template 'operator ""PRId64' not found

7 years agoMerge pull request #310 from marxin/fix-gcc7-warnings
Eric Haszlakiewicz [Thu, 23 Mar 2017 03:37:14 +0000 (23:37 -0400)]
Merge pull request #310 from marxin/fix-gcc7-warnings

Add FALLTHRU comment to handle GCC7 warnings.

7 years agoAdd FALLTHRU comment to handle GCC7 warnings.
marxin [Tue, 21 Mar 2017 07:42:11 +0000 (08:42 +0100)]
Add FALLTHRU comment to handle GCC7 warnings.

7 years agoMerge pull request #305 from alexanderst/master
Eric Haszlakiewicz [Sat, 4 Mar 2017 04:12:56 +0000 (23:12 -0500)]
Merge pull request #305 from alexanderst/master

Fix compilation without C-99 option

7 years agoFix compilation without C-99 option
Alex [Thu, 2 Mar 2017 08:57:49 +0000 (10:57 +0200)]
Fix compilation without C-99 option

7 years agoAdd a few more cases to test_parse to provide some examples of how parsing works...
Eric Haszlakiewicz [Sun, 26 Feb 2017 16:22:45 +0000 (16:22 +0000)]
Add a few more cases to test_parse to provide some examples of how parsing works; should help address the questions raised in Issue #302.

7 years agoMerge pull request #303 from yogo1212/tokener_h
Eric Haszlakiewicz [Sat, 25 Feb 2017 03:34:36 +0000 (22:34 -0500)]
Merge pull request #303 from yogo1212/tokener_h

fix doc in tokener header file

7 years agofix doc in tokener header file
Leon M. George [Mon, 20 Feb 2017 03:41:55 +0000 (04:41 +0100)]
fix doc in tokener header file

7 years agoIssue #300: Cast size_t values to int instead of unsigned long long to work around...
Eric Haszlakiewicz [Sun, 5 Feb 2017 17:00:35 +0000 (17:00 +0000)]
Issue #300: Cast size_t values to int instead of unsigned long long to work around broken behavior of MinGW.

7 years agoIssue #300: Some platforms, such as MinGW, don't have ETXTBSY and ENOTBLK, so skip...
Eric Haszlakiewicz [Sun, 5 Feb 2017 04:43:54 +0000 (04:43 +0000)]
Issue #300: Some platforms, such as MinGW, don't have ETXTBSY and ENOTBLK, so skip those there.