Commit Graph

1026 Commits

Author SHA1 Message Date
Eric Hawicz
bc06f82f85 Merge pull request #628 from clamwin/compat-fixes-master
get_cryptgenrandom_seed: compat with old windows + fallback
2020-06-03 23:53:46 -04:00
Gianluigi Tiesi
481d0a8ede get_cryptgenrandom_seed: compat with old windows + fallback 2020-06-03 07:51:42 +02:00
Eric Haszlakiewicz
1c6086a86a 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. 2020-05-31 03:22:14 +00:00
Eric Haszlakiewicz
fe308b8862 Issue #626: Restore compatibility with cmake 2.8 by adjusting quoting and explicitly defining the PROJECT_VERSION* variables. 2020-05-30 19:37:46 +00:00
Eric Haszlakiewicz
4a546e7b2f In arraylist, use malloc instead of calloc, avoid clearing with memeset until we really need to, and micro-optimize array_list_add(). 2020-05-24 03:54:04 +00:00
Eric Hawicz
fbe1543644 Merge pull request #622 from besser82/topic/besser82/doc_subdir
doc: Move Doxyfile into doc subdir.
2020-05-18 15:30:21 -04:00
Björn Esser
1e94da779a CMake: Fix grammar: written -> wrote. 2020-05-18 20:36:16 +02:00
Björn Esser
61e2bae511 doc: Move Doxyfile into doc subdir 2020-05-18 20:36:16 +02:00
Eric Haszlakiewicz
fa6a7dccb9 With the change in cc80203, Doxyfile no longer needs to be updated for a release. 2020-05-18 17:31:22 +00:00
Eric Hawicz
cc802039a8 Merge pull request #619 from besser82/topic/besser82/doxygen_oot
CMake: Fix out-of-tree build for Doxygen documentation.
2020-05-18 13:30:13 -04:00
Eric Hawicz
12b2e1159d Merge pull request #618 from besser82/topic/besser82/test_deep_copy
test_deep_copy: Fix assertion value.
2020-05-18 13:29:21 -04:00
Björn Esser
8f3592b3d5 CMake: Fix out-of-tree build for Doxygen documentation. 2020-05-18 18:20:33 +02:00
Björn Esser
3008401b2a test_deep_copy: Fix assertion value. 2020-05-18 17:06:37 +02:00
Eric Hawicz
a8a0590921 Merge pull request #617 from besser82/topic/besser82/option_disable_tls
Add an option to disable the use of thread-local storage.
2020-05-18 10:25:54 -04:00
Björn Esser
a85d2395ff README: Update configuration options for CMake. 2020-05-18 12:41:18 +02:00
Björn Esser
76dd99abb2 CMake: Re-format config-option block and re-order it alphabetically. 2020-05-18 12:34:08 +02:00
Björn Esser
78642dcb9b 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.
2020-05-18 12:27:19 +02:00
Björn Esser
dd040ba446 tests: Fix test_double_serializer without thread-local storage. 2020-05-18 12:27:00 +02:00
Eric Hawicz
5b15c7567d Merge pull request #614 from stoeckmann/format
Prevent truncation on custom double formatters.
2020-05-16 21:04:11 -04:00
Eric Hawicz
311c5e5b2b Update issue templates 2020-05-16 20:55:20 -04:00
Tobias Stoeckmann
5385a566db 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.
2020-05-16 15:26:16 +02:00
Eric Haszlakiewicz
0a3d22b9bb 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. 2020-05-16 01:29:18 +00:00
Eric Hawicz
1526c84a13 Merge pull request #606 from davidjmccann/master
Improved support for IBM operating systems
2020-05-15 21:15:18 -04:00
David McCann
add7b13a9a Improved support for IBM operating systems
Fix compiler errors and warnings when building on IBM operating systems such as AIX and IBM i.
2020-05-14 15:39:35 +01:00
Eric Haszlakiewicz
d414d3eabc Issue #604: add check for __MINGW32__ in snprintf_compat.h 2020-05-13 14:53:05 +00:00
Eric Haszlakiewicz
2e71fe0963 Display a bit of info about what exactly we're benchmarking. 2020-05-11 03:05:20 +00:00
Eric Haszlakiewicz
199c52e2db Ignore the bench/work and bench/data directories. 2020-05-11 03:04:10 +00:00
Eric Hawicz
3648c3ed2c Merge pull request #602 from ploxiln/parse_uint64_errno
fix json_parse_uint64() usage of errno
2020-05-10 21:15:47 -04:00
Pierce Lopez
003b58782b fix json_parse_uint64() usage of errno
introduced in #542
fixes #601
2020-05-10 13:38:12 -04:00
Eric Haszlakiewicz
26f080997d Fix snprintf on windows problem for test4. 2020-05-10 04:04:28 +00:00
Eric Haszlakiewicz
06742d6277 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. 2020-05-10 03:58:51 +00:00
Eric Haszlakiewicz
a59d5acfab Re-format after recent change to fix linkhash. 2020-05-10 03:58:27 +00:00
Eric Haszlakiewicz
4f43a077a4 Issue #598: avoid building static libraries twice. 2020-05-10 03:48:45 +00:00
Eric Haszlakiewicz
519dfe1591 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.
2020-05-10 03:36:05 +00:00
Eric Hawicz
45b6416652 Merge branch 'master' of https://github.com/json-c/json-c 2020-05-08 22:25:15 -04:00
Eric Hawicz
abc9a0731b Merge pull request #597 from ploxiln/json_parse_usage
json_parse demo: fix and use usage() function
2020-05-08 22:23:28 -04:00
Pierce Lopez
090ae4e4d4 json_parse demo: fix and use usage() function 2020-05-08 18:27:35 -04:00
Eric Hawicz
22870ac2bd Merge pull request #595 from dota17/static_shared
Support to build both static and shared libraries
2020-05-07 23:23:15 -04:00
hofnarr
a100573eec cmake-configure: fix enable-static option 2020-05-08 02:27:06 +03:00
hofnarr
558ef8609c cmake: change variable name 2020-05-08 02:19:38 +03:00
hofnarr
929d74512a cmake: add list for build targets 2020-05-08 02:16:52 +03:00
dota17
e97fc20bfd update 2020-05-07 14:50:43 +08:00
Eric Hawicz
31243e4d12 Merge pull request #592 from stoeckmann/oob
Prevent out of boundary write on malicious input
2020-05-06 23:31:15 -04:00
Tobias Stoeckmann
d07b910149 Fix integer overflows.
The data structures linkhash and printbuf are limited to 2 GB in size
due to a signed integer being used to track their current size.

If too much data is added, then size variable can overflow, which is
an undefined behaviour in C programming language.

Assuming that a signed int overflow just leads to a negative value,
like it happens on many sytems (Linux i686/amd64 with gcc), then
printbuf is vulnerable to an out of boundary write on 64 bit systems.
2020-05-06 20:46:12 +02:00
dota17
952db0f397 support to build both static and shared libraries 2020-05-06 14:46:47 +08:00
Tobias Stoeckmann
77d935b7ae Prevent division by zero in linkhash.
If a linkhash with a size of zero is created, then modulo operations
are prone to division by zero operations.

Purely protective measure against bad usage.
2020-05-04 19:46:45 +02:00
Tobias Stoeckmann
099016b7e8 Protect array_list_del_idx against size_t overflow.
If the assignment of stop overflows due to idx and count being
larger than SIZE_T_MAX in sum, out of boundary access could happen.

It takes invalid usage of this function for this to happen, but
I decided to add this check so array_list_del_idx is as safe against
bad usage as the other arraylist functions.
2020-05-04 19:41:16 +02:00
Eric Haszlakiewicz
8e3d3d5544 Make the benchmark work with pre-cmake versions of json-c. Fetch a few more data files. 2020-05-04 03:40:40 +00:00
Eric Haszlakiewicz
c66e7377f3 In jc-bench.sh, decode the --before and --after args. Use a separate data dir to avoid re-downloading files when the work dir is cleared. 2020-05-04 03:24:39 +00:00
Eric Haszlakiewicz
8086314026 Issue #589: drop the rdrand test loops to just 3, tweak comments and add some links to bug reports, and decrease the nesting level of the has_rdrand() function. 2020-05-04 01:33:15 +00:00