Commit Graph

1041 Commits

Author SHA1 Message Date
Alexandru Ardelean
ba8625a701 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>
2017-07-11 10:38:25 +03:00
Eric Haszlakiewicz
dd8dcb8228 Merge pull request #335 from commodo/build_status_travis
README.md: show build status tag from travis-ci.org
2017-07-11 00:16:12 -04:00
Alexandru Ardelean
061afc7993 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>
2017-07-10 11:45:24 +03:00
Eric Haszlakiewicz
b64402ede2 Move a variable declaration to the start of the block to work better with older compilers. 2017-07-09 16:09:09 -07:00
Eric Haszlakiewicz
a14ada5730 Remove a spurious comma in configure.ac 2017-07-09 16:00:32 -07:00
Eric Haszlakiewicz
33db761551 Updated expected test1 output which should have been included in commit fd9b3b2. 2017-07-09 15:22:53 -07:00
Eric Haszlakiewicz
1d3e97f2ab 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. 2017-07-09 15:13:02 -07:00
Eric Haszlakiewicz
f7a44ad101 Add extra casts to void * to squash some warning on certain systems (e.g. CentOS w/ gcc 4.1.2). 2017-07-09 15:08:21 -07:00
Eric Haszlakiewicz
7b7a76e161 Fix bad usage of strncat introduces in 1a94c70. Pointed out by @rouault in PR #331. 2017-07-09 15:04:18 -07:00
Eric Haszlakiewicz
55ecae3e58 Eliminate static qualifiers on a couple local variables that were causing thread safety issues. Suggested by @rouault in PR #331. 2017-07-09 14:56:18 -07:00
Eric Haszlakiewicz
5a99e527ff Reformat json_object_double_to_json_string_format() to have consistent spacing. 2017-07-08 20:33:28 -07:00
Eric Haszlakiewicz
5e33dabda1 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. 2017-07-08 19:35:06 -07:00
Eric Haszlakiewicz
fd9b3b2260 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.
2017-07-08 19:04:35 -07:00
Eric Haszlakiewicz
7fd74fc7a3 Merge pull request #312 from Tailmon/master
Fix CMake Build process improved for MinGW and MSYS2
2017-07-08 21:25:48 -04:00
Eric Haszlakiewicz
4deed587e7 Merge pull request #319 from Dashlane/visual-studio-build
Windows: Fix dynamic library build with Visual Studio
2017-07-08 21:24:55 -04:00
Eric Haszlakiewicz
a3f97eeeeb Merge pull request #329 from commodo/rename-static-lib
build,cmake: build,cmake: rename libjson-c-static.a to libjson-c.a
2017-07-08 15:44:27 -04:00
Eric Haszlakiewicz
db3115cee9 Merge pull request #330 from commodo/symlink_some_tests
tests: symlink basic tests to a single file that has the common code
2017-07-08 15:43:45 -04:00
Eric Haszlakiewicz
cc201fdcaa Merge pull request #333 from besser82/bugfix/obsolete_macros_autotools
Replace obsolete AM_PROG_LIBTOOL
2017-07-08 15:17:17 -04:00
Björn Esser
cec97ebc6f Replace obsolete AM_PROG_LIBTOOL 2017-07-04 12:54:46 +02:00
Alexandru Ardelean
73636c2ed0 tests: symlink basic tests to a single file that has the common code
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-06-22 10:08:26 +03:00
Alexandru Ardelean
8f6ecbf37b 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>
2017-06-19 18:12:28 +03:00
Alexandru Ardelean
4fb2eefac2 build,cmake: rename libjson-c-static.a to libjson-c.a
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-06-19 18:08:45 +03:00
Eric Haszlakiewicz
a36396992d Merge pull request #321 from commodo/fix-cmake-vasprintf
build,cmake: fix vasprintf implicit definition and generate both static & shared libs
2017-06-19 00:34:44 -04:00
Eric Haszlakiewicz
e8e574fbe4 Issue #161: add a json_object_to_fd() function. 2017-06-18 18:44:45 +00:00
Eric Haszlakiewicz
23e064ad29 Fix test_double_serializer expected output. 2017-06-18 18:34:41 +00:00
Eric Haszlakiewicz
1a94c70336 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. 2017-06-18 18:12:07 +00:00
Eric Haszlakiewicz
8581806558 Make _set_last_err() non-static so it can be used outside of json_util.c 2017-06-18 18:11:17 +00:00
Eric Haszlakiewicz
e76ea37772 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()
2017-05-21 21:35:16 -04:00
Even Rouault
2c2deb87f8 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
2017-05-18 22:36:35 +02:00
Alexandru Ardelean
f10a5ae4d7 .gitignore: add cmake generated files
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-05-03 12:00:38 +03:00
Alexandru Ardelean
4b5e39c89c build,cmake: generate both static and shared libjson
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-05-03 12:00:38 +03:00
Alexandru Ardelean
cfbbb23141 build,cmake: add _GNU_SOURCE to CFLAGS
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-05-03 11:36:45 +03:00
David Henot
a9f265d166 Fix library build with Visual Studio 2017-04-26 14:11:17 +02:00
Pablo Sanabria
d3f813a14e 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
2017-03-26 23:14:37 -03:00
Pablo Sanabria
2cda677d06 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
2017-03-26 23:14:37 -03:00
Eric Haszlakiewicz
6bd86d1044 Merge pull request #311 from jj1118/master
Fix error C3688 when compiling on Visual Studio 2015
2017-03-26 03:52:57 +00:00
Jason Li
0f81ecf5f4 Fix error C3688 when compiling on Visual Studio 2015: invalid literal suffix 'PRId64'; literal operator or literal operator template 'operator ""PRId64' not found 2017-03-24 14:53:25 +08:00
Eric Haszlakiewicz
4e673656a1 Merge pull request #310 from marxin/fix-gcc7-warnings
Add FALLTHRU comment to handle GCC7 warnings.
2017-03-22 23:37:14 -04:00
marxin
014924ba89 Add FALLTHRU comment to handle GCC7 warnings. 2017-03-21 08:42:11 +01:00
Eric Haszlakiewicz
82f5a4ab29 Merge pull request #305 from alexanderst/master
Fix compilation without C-99 option
2017-03-03 23:12:56 -05:00
Alex
175d934cff Fix compilation without C-99 option 2017-03-02 10:57:49 +02:00
Eric Haszlakiewicz
8c86207258 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. 2017-02-26 16:22:45 +00:00
Eric Haszlakiewicz
d74b7eb144 Merge pull request #303 from yogo1212/tokener_h
fix doc in tokener header file
2017-02-24 22:34:36 -05:00
Leon M. George
482e771af1 fix doc in tokener header file 2017-02-20 04:41:55 +01:00
Eric Haszlakiewicz
3948fcad2d Issue #300: Cast size_t values to int instead of unsigned long long to work around broken behavior of MinGW. 2017-02-05 17:00:35 +00:00
Eric Haszlakiewicz
bad6c9a427 Issue #300: Some platforms, such as MinGW, don't have ETXTBSY and ENOTBLK, so skip those there. 2017-02-05 04:44:30 +00:00
Eric Haszlakiewicz
9a64fd7d55 Issue #300: Use %p instead of %lx in test_util_file since some platforms' pointers are larger than "unsigned long".
Also, there's no need to worry about output consistency here, since it'll be
 different anyway due to different pointer values.
2017-02-05 04:38:53 +00:00
Eric Haszlakiewicz
91977159ee Add cast to int in calls to isdigit() since some platforms complain about char being used as an array index. 2017-02-05 04:34:05 +00:00
Eric Haszlakiewicz
3fab117e4e Merge pull request #299 from qlyoung/perf-improvements
Improve json_object -> string performance
2017-02-04 11:13:14 -05:00
Quentin Young
f6f852fd93 Restore sprintbuf(), add macro for string literals
Hawciz pointed out that the previous commit modifies the public
interface of printbuf. Per his suggestion, sprintbuf() was restored
and a new pair of macros was added that wraps printbuf_memappend().

Using a wrapper macro instead of modifying sprintbuf() also reduces
function call overhead, bringing total performance gains to
approximately 400%.
2017-02-04 01:02:00 +00:00