Commit Graph

973 Commits

Author SHA1 Message Date
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
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
1059007024 Add an initial version of a benchmarking harness for json-c, to be able to more easily compare the performance of different library versions. 2020-04-27 04:00:00 +00:00
Eric Haszlakiewicz
d9981f67dd Extend the CMakeLists.txt in the apps directory to be usable as a standalone build, to link against other versions of json-c.
Tweak json_parse.c slightly to allow it to build against older json-c versions.
2020-04-26 04:02:36 +00:00
Eric Haszlakiewicz
00272292a7 The json_parse command line app doesn't build on Windows, disable it. 2020-04-21 21:35:41 +00:00
Eric Haszlakiewicz
55d053118e Add an apps directory, and a json_parse program to parse an input file and report on memory usage.
This is intended to provide a way, during development, to test out the memory
and performance impacts of a change.
2020-04-21 03:57:56 +00:00
Eric Haszlakiewicz
f6f76f9430 Add a JSON_TOKENER_ALLOW_TRAILING_CHARS flag for json_tokener_set_flags() to allow multiple objects to be parsed from input even when JSON_TOKENER_STRICT is set. 2020-04-21 03:53:44 +00:00
Eric Haszlakiewicz
05623b3a2e Add an tok_flags field to explicitly specify tokener flags in test_parse and eliminate the previous bogus calls to json_tokener_set_flags() 2020-04-21 03:53:44 +00:00
Eric Haszlakiewicz
fa6bc1e2d7 Issue #471: always create directories with mode 0755, regardless of umask. 2020-04-21 03:19:17 +00:00
Eric Haszlakiewicz
8b511c402b Issue #585: don't install config.h 2020-04-21 01:13:21 +00:00
Eric Haszlakiewicz
ba4527904a Add a few missing git commands to the release checklist, and change the S3 storage to "Standard", since it's actually (barely) cheaper than "Reduced Redundancy" now. 2020-04-19 04:17:29 +00:00
Eric Haszlakiewicz
2babb5b780 Update the master branch to version 0.0.14.99 2020-04-19 03:57:08 +00:00
Eric Haszlakiewicz
31ab57ca8b Fill in the ChangeLog for the upcoming 0.14 release. 2020-04-19 01:31:48 +00:00
Eric Haszlakiewicz
9ed00a694b Fill in a few more pre-release steps to match what we've done for the 0.14 release.
Move the list of contributors to the AUTHORS file.
2020-04-19 01:28:24 +00:00
Eric Haszlakiewicz
4badbe9c20 Rewrite the issued_closed_for_* files so they display a bit nicer. 2020-04-18 03:22:52 +00:00
Eric Haszlakiewicz
0a95f98b8d Explicitly mark several things in json_tokener deprecated. 2020-04-18 02:42:46 +00:00
Eric Haszlakiewicz
ecb9354bb1 Re-do clang-format. 2020-04-18 02:14:13 +00:00
Eric Haszlakiewicz
23ddcbd4da Make json_abort() internal to json_object.c 2020-04-18 02:05:37 +00:00
Eric Haszlakiewicz
5cc11289b4 Make json_tokener_validate_utf8() internal to json_tokener.c, and improve the docs a bit. 2020-04-18 02:02:06 +00:00
Eric Haszlakiewicz
4dc0f1718e Merge pull request #582 from dota17/list_closed_issue_pr
add the list of issues& prs closed
2020-04-17 13:32:17 -04:00
dota17
4313465f25 update 2020-04-17 09:47:30 +08:00
dota17
8bdb420d0f manual adjustment 2020-04-16 16:30:14 +08:00
dota17
6bf6a9e248 add the list of issues& prs closed 2020-04-16 16:15:04 +08:00
Eric Haszlakiewicz
a9114392b4 Merge pull request #524 from dota17/addTestCase_obj_token
Increase coverage
2020-04-15 23:35:21 -04:00
Eric Haszlakiewicz
04bb0fca73 Merge pull request #581 from Jehan/wip/Jehan/no-strict-prototypes-windows
CMakeLists: do not enforce strict prototypes on Windows.
2020-04-15 23:32:59 -04:00
dota17
b14363ae32 remove unsuitable case 2020-04-15 20:06:12 +08:00
Jehan
8c33d1c3c9 CMakeLists: do not enforce strict prototypes on Windows.
On Windows, or at least when cross-built with Mingw-w64, build fails
because strict prototype fails on an included file (thus nothing we can
do about in json-c code):

> from /home/jehan/dev/src/json-c/json_util.c:44:
> /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:196:3: error: function declaration isn't a prototype [-Werror=strict-prototypes]
>   196 |   typedef INT_PTR (WINAPI *FARPROC) ();
>       |   ^~~~~~~
> /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:197:3: error: function declaration isn't a prototype [-Werror=strict-prototypes]
>   197 |   typedef INT_PTR (WINAPI *NEARPROC) ();
>       |   ^~~~~~~
> /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:198:3: error: function declaration isn't a prototype [-Werror=strict-prototypes]
>   198 |   typedef INT_PTR (WINAPI *PROC) ();
>       |   ^~~~~~~

Let's just disable the errors for Windows build.
2020-04-15 13:03:11 +02:00
Eric Haszlakiewicz
7fb8d56458 Merge pull request #580 from besser82/topic/besser82/fix_cmake_tests
Fix CMake tests for enforced strict prototypes.
2020-04-14 15:17:21 -04:00
Björn Esser
053eaa61d7 Fix CMake tests for enforced strict prototypes. 2020-04-14 20:42:32 +02:00
Eric Haszlakiewicz
ab5425a6a6 Merge pull request #527 from dota17/arraylist_test
Arraylist testcase
2020-04-14 10:28:16 -04:00
Eric Haszlakiewicz
511edb51a4 Merge pull request #579 from besser82/topic/besser82/strict-prototypes
Enforce strict prototypes.
2020-04-14 10:25:13 -04:00
dota17
2876fcc137 clang-format two test_util_file.c and test_object_iterator.c 2020-04-14 10:15:27 +08:00
chenguoping
8096125618 Increased the test coverage of json_util.c from 76% to 90.3%. 2020-04-14 10:10:47 +08:00
chenguoping
f56c5c1a60 Increased the test coverage of json_object_iterator.c from 0% to 100% 2020-04-14 10:03:58 +08:00
dota17
74bbe349c4 clang-format test1.c 2020-04-14 09:20:51 +08:00
chenguoping
110c60fcdd fix valgrind errors 2020-04-14 09:13:29 +08:00
chenguoping
76e1472808 testcase for array_list 2020-04-14 09:13:06 +08:00
Björn Esser
d0dc3489dc Enforce strict prototypes. 2020-04-13 11:29:52 +02:00
Eric Haszlakiewicz
4742a2ab1d Merge pull request #578 from besser82/topic/besser82/pkgconfig_install
CMake: Install pkgconfig file in proper location by default
2020-04-12 20:52:01 -04:00
Björn Esser
165e6f58fc CMake: Install pkgconfig file in proper location by default
The default location for pkconfig files on most systems is:
  ${CMAKE_INSTALL_LIBDIR}/pkgconfig

Thus the file should get installed in there by default.
2020-04-12 19:21:54 +02:00
Eric Haszlakiewicz
8269f90956 Merge pull request #577 from besser82/topic/besser82/json_c_version_test_verbose_on_fail
Be verbose on failing json_c_version test.
2020-04-11 22:35:40 -04:00
Björn Esser
5e699f7f73 Be verbose on failing json_c_version test. 2020-04-11 21:09:31 +02:00
Eric Haszlakiewicz
c58d56ab7c Merge pull request #576 from besser82/topic/besser82/increase_coverage
Test coverage for json_c_version.
2020-04-11 14:45:45 -04:00
Eric Haszlakiewicz
d52f1ff2c1 Merge pull request #575 from besser82/topic/besser82/cosmetics
Small cosmetics.
2020-04-11 14:18:37 -04:00
Björn Esser
d47fb12e85 Test coverage for json_c_version. 2020-04-11 12:33:59 +02:00
Björn Esser
73a2ed115a Remove multiple trailing newlines at EOF. 2020-04-11 10:35:42 +02:00
Björn Esser
fd0ae5aba6 gitignore: Add build folder. 2020-04-11 09:41:04 +02:00
Björn Esser
78cd37fb18 Clean trailing white-space. 2020-04-11 09:41:04 +02:00
Björn Esser
37355cf0e6 Fix line terminators to be UNIX. 2020-04-11 09:40:57 +02:00