Commit Graph

146 Commits

Author SHA1 Message Date
Max Bruckner
469a437e2a Add valgrind suppressions for ARVMv7 ArchlinuxARM 2017-07-15 11:59:47 +02:00
Max Bruckner
954d61e5e7 Fix #189, ensure returns an invalid pointer
If realloc returns NULL, ensure didn't abort but returned
printbuffer.offset instead. If an attacker can control
printbuffer.offset and also make realloc fail at just the right moment,
this would make cJSON potentially write at an arbitrary memory address.
2017-07-12 23:02:31 +02:00
Max Bruckner
5baa77f86c cJSON_Parse{,WithOpts}: Skip UTF-8 (Byte Order Marks) 2017-07-03 22:28:04 +02:00
Max Bruckner
45e1278acb tests/print_number: Add test with 17 digits of precision 2017-06-28 17:28:50 +02:00
Max Bruckner
21733eb02e tests/print_number: Use proper double literals 2017-06-28 17:28:49 +02:00
Max Bruckner
a9ce4e6bbc Add warning -Wswitch-enum 2017-06-28 17:28:49 +02:00
Max Bruckner
4e0c119391 Add warning -Wmissing-variable-declarations 2017-06-28 17:28:49 +02:00
Max Bruckner
18ad8a8770 misc_utils_tests: call all utils function with NULL pointers 2017-06-28 16:01:20 +02:00
Max Bruckner
bdd5ff7ad6 misc_tests: Call all functions with NULL pointers 2017-06-28 14:22:42 +02:00
Max Bruckner
03ba72faec cJSON_Compare: Fix comparison of objects
It did consider two arrays equal if one is a subset of te other one,
which is incorrect.

See #180
2017-06-14 17:48:56 +02:00
Max Bruckner
569aa060c6 cJSON_Compare: Fix comparison of arrays
It did consider two arrays equal if one is a prefix of the other one,
which is incorrect.

See #180
2017-06-14 17:48:56 +02:00
Max Bruckner
bfbd8fe0d8 tests/parse_hex4: Fix GCC 7 compiler warning (fixes #179) 2017-06-04 21:29:14 +02:00
Max Bruckner
82295f9e4f Update Unity 2017-06-04 19:36:46 +02:00
Max Bruckner
9ecc96878f fix #174: cJSON_ReplaceItemInObject doesn't copy name 2017-05-22 22:55:05 +02:00
Max Bruckner
b537ca70a3 old_utils_tests: Remove leftover unused attribute 2017-05-10 01:15:28 +02:00
Max Bruckner
a01267c0a4 Update json-patch-tests 2017-05-02 01:56:12 +02:00
Max Bruckner
e1f6470dae json_patch_tests.c: Use case sensitive functions 2017-05-02 01:54:49 +02:00
Max Bruckner
8b953d1202 Add cJSON_ReplaceItemViaPointer 2017-05-02 01:18:55 +02:00
Max Bruckner
c24c3e0285 Add cJSON_DetachItemViaPointer 2017-05-01 23:58:04 +02:00
Max Bruckner
b00ecfd311 Merge commit '48b390994642e59eb1a461922a646b4c6544693c' into develop 2017-05-01 18:02:03 +02:00
Max Bruckner
87fad25c2b Merge pull request #153 from DeboraG/print_number_prec
cJSON: Fix print_number to print significant digits of doubles
2017-04-29 19:56:58 +02:00
Max Bruckner
28570ad095 Add test for cJSON_SetNumberHelper 2017-04-28 14:41:24 +02:00
Max Bruckner
7fe8d53c19 Use json-patch-tests to test generation of tests with cJSON_Utils 2017-04-28 01:59:54 +02:00
Max Bruckner
18b4e2f941 Update Unity to release 2.4.1 2017-04-27 02:55:04 +02:00
Max Bruckner
949c083315 Move 'hooks' parameter into buffers (parse/print) 2017-04-27 02:48:28 +02:00
Max Bruckner
c4c217f2ce Move 'format' into printbuffer 2017-04-27 02:21:09 +02:00
Max Bruckner
79f30800ec Move print depth into printbuffer 2017-04-27 02:10:03 +02:00
Max Bruckner
e0d3a8a265 Limit nesting depth to 1000 and make it configurable. 2017-04-27 01:57:45 +02:00
Debora Grosse
3fc9bc0648 cJSON: Fix print_number to print significant digits of doubles 2017-04-20 10:55:09 -04:00
Max Bruckner
6ccfd5d603 tests: Move most of test_utils.c to old_utils_tests 2017-04-18 14:11:14 +02:00
Max Bruckner
49ebc85e7a Move ApplyPatch tests from test_utils.c to json. 2017-04-13 20:15:25 +02:00
Max Bruckner
ba7b48b3f3 Enable json-patch-tests tests 2017-04-12 20:50:04 +02:00
Max Bruckner
8c900b9e07 Merge commit '7276f4df051bc58af8a2da7d3199517d43d37582' as 'tests/json-patch-tests' 2017-04-11 14:45:28 +02:00
Max Bruckner
6ac896d8d2 cJSON_Compare: New function to compare json 2017-04-08 17:57:36 +02:00
Max Bruckner
bc0bb7c224 parse_with_opts: test return_parse_end 2017-04-08 17:56:27 +02:00
Max Bruckner
770e8263a5 tests for cJSON_ParseWithOpts 2017-04-08 17:56:27 +02:00
Max Bruckner
2683589d93 parser: Construct error pointer from buffer offset 2017-04-08 17:56:26 +02:00
Max Bruckner
87a204ed0b parse_functions: Return booleans instead of pointers 2017-04-08 17:56:26 +02:00
Max Bruckner
778a0c146f parse_string: Use parsebuffer 2017-04-08 17:56:25 +02:00
Max Bruckner
f69b109c9f parse_number: Use parse_buffer 2017-04-08 17:56:25 +02:00
Max Bruckner
fef1c45b92 parse_object: Use parse_buffer 2017-04-08 17:56:25 +02:00
Max Bruckner
033a542532 parse_array: Use parsebuffer 2017-04-08 17:56:25 +02:00
Max Bruckner
fd0320cf54 parse_value: Use parse_buffer 2017-04-08 17:56:24 +02:00
Max Bruckner
c08f7e1d29 print_number: Make locale independent
This first prints the number into a temporary buffer and then copies the
number to the output.

A positive side effect is that cJSON no longer reserves more space for
the number in the output than is necessary.
2017-04-08 03:38:49 +02:00
Max Bruckner
84237ff48e Replace sizeof('\0') with sizeof("")
Because sizeof('\0') is actually sizeof(int) not sizeof(char).
2017-04-08 01:29:19 +02:00
Max Bruckner
2f65e80a34 Fix internal compiler error in GCC on x86 2017-03-28 17:32:20 +02:00
Max Bruckner
4ec6e76ea2 tests: print_number: Fix build on 32bit ppc (and potentially others) 2017-03-18 13:25:18 +01:00
Max Bruckner
30e1e7af7c CMake: Support cmake down to 2.8.5 2017-03-16 01:09:26 +01:00
Max Bruckner
76e5296d0d CMake: Fix per target disabling of compiler flags
The compiler flag detection was working incorrectly.
2017-03-16 00:22:53 +01:00
Max Bruckner
c597601cf1 tests: run cJSON_test{,_utils} along with the other tests 2017-03-15 20:11:19 +01:00
Max Bruckner
030d0c14cc Merge branch 'develop' (Release 1.4.0) 2017-03-03 23:26:52 +01:00
Max Bruckner
5ea4fad263 print_string: return boolean instead of pointer 2017-03-03 00:33:11 +01:00
Max Bruckner
1749de02f8 print_number: return boolean instead of pointer 2017-03-03 00:26:58 +01:00
Max Bruckner
748f4bfd4f print_object: return boolean instead of pointer 2017-03-03 00:21:34 +01:00
Max Bruckner
bea1d102fd print_array: return boolean instead of pointer 2017-03-03 00:16:54 +01:00
Max Bruckner
d441fa05b3 print_value: return boolean instead of pointer 2017-03-03 00:11:43 +01:00
Max Bruckner
ad5abf4c5b Update unity with fixes for compiler warnings 2017-03-01 23:20:30 +01:00
Max Bruckner
6405fd15e3 CMake: Set default visibility to hidden and dllexport on windows 2017-03-01 23:19:35 +01:00
Max Bruckner
b44c917be9 tests/common: use CJSON_PUBLIC 2017-03-01 23:16:19 +01:00
Max Bruckner
2e118df0cd tests/common.h: Remove unused prototype 2017-03-01 22:47:45 +01:00
Max Bruckner
0c0dd4a5b0 tests: test trim_trailing_zeroes 2017-03-01 18:29:01 +01:00
Max Bruckner
1ea72f8260 print_number: Remove trailing zeroes (for doubles) 2017-03-01 13:22:32 +01:00
Max Bruckner
1e0bd24f2c Revert "unity: make it work with -Wconversion"
This reverts commit 12acc57967.
2017-03-01 11:57:07 +01:00
Max Bruckner
40e3781e9b CMake: Disable -Werror for Unity 2017-03-01 11:57:07 +01:00
Max Bruckner
b056d7cb74 Add -Wcomma compiler flag 2017-03-01 11:57:06 +01:00
Max Bruckner
899529e866 Update unity 2017-03-01 09:23:18 +01:00
Fabrice Fontaine
695d8a01a9 Do not build unity library if tests are disabled
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2017-02-28 20:48:04 +01:00
Max Bruckner
c45dc12fd7 Tests for typecheck functions 2017-02-26 21:54:01 +01:00
Max Bruckner
68cd0d4a11 cJSON.c: Pass allocation functions through internal functions
This is the first step in removing the global allocator functions. Every
internal function now only accesses its locally available set of
allocators.
2017-02-21 14:50:49 +01:00
Max Bruckner
56b819bfbc tests: test cJSON_GetObjectItem and cJSON_GetObjectItemCaseSensitive 2017-02-21 11:17:08 +01:00
Max Bruckner
cbbcc91498 tests: cJSON_ArrayForEach 2017-02-21 09:17:49 +01:00
Max Bruckner
88e38d042f tests: print_string: test if NULL is printed as empty string 2017-02-20 23:07:23 +01:00
Max Bruckner
de36476092 tests: print_value 2017-02-20 11:11:02 +01:00
Max Bruckner
983a4cd286 tests: parse_objects: Fix name of test 2017-02-20 11:11:01 +01:00
Max Bruckner
b6abef94ff tests: print_object 2017-02-20 11:11:01 +01:00
Max Bruckner
3d66766231 tests: print_array 2017-02-20 11:11:01 +01:00
Max Bruckner
924122904e tests: print_number 2017-02-20 11:11:01 +01:00
Max Bruckner
8aa324fdc8 tests: print_string 2017-02-20 11:11:01 +01:00
Max Bruckner
7c722dca5f CMake: Add target "check" that builds and runs tests 2017-02-17 13:59:26 +01:00
Max Bruckner
5986edba1d tests: Ensure that failed parsing returns invalid items 2017-02-15 21:25:52 +01:00
Max Bruckner
c6e1a281f9 tests: assertion macros 2017-02-15 21:25:52 +01:00
Max Bruckner
4f58695ed3 tests: extract common functionality to common.c 2017-02-15 21:25:51 +01:00
Max Bruckner
21c02cd3e5 CMake: Add Valgrind support 2017-02-07 21:35:21 +01:00
Max Bruckner
5a36b71a80 unity-tests: parse_value 2017-02-07 21:35:21 +01:00
Max Bruckner
9041570eba unity-tests: parse_object 2017-02-07 21:35:21 +01:00
Max Bruckner
71b05fd4c2 unity-tests: parse_array 2017-02-07 21:35:21 +01:00
Max Bruckner
598b609c45 unity-tests: parse_string 2017-02-07 21:35:20 +01:00
Max Bruckner
b0e5209bde unity-tests: test parse_hex4 2017-02-07 21:35:20 +01:00
Max Bruckner
7fd536d7e0 unity-tests: parse_number 2017-02-07 21:35:20 +01:00
Max Bruckner
be0951dfa4 Move parse tests from test.c -> parse_example.c 2017-02-07 21:35:20 +01:00
Max Bruckner
bb60d6def5 cunity: parse_examples: test example files
Test parsing and printing example files
2017-02-07 21:35:19 +01:00
Max Bruckner
896e52255b CMake: Build unity as library 2017-02-07 21:35:19 +01:00
Max Bruckner
12acc57967 unity: make it work with -Wconversion 2017-02-07 21:35:19 +01:00
Max Bruckner
d19f3ae890 Merge commit '6b9b57be226a505a9c9cdd9ed029f22495ce04ec' as 'tests/unity' 2017-02-07 21:30:57 +01:00
Christian Schulze
52d7d14f6c fixed segfault when the lib tries to parse HTML with embedded CSS; provided test case 2016-03-06 16:43:53 +01:00
Dave Gamble
805b652e51 here it is, cJSON 1.0
git-svn-id: http://svn.code.sf.net/p/cjson/code@1 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-08-26 03:55:20 +00:00