Commit Graph

30 Commits

Author SHA1 Message Date
a6424b85dd feat: add cJSON_SetBoolValue and test (#639)
* cJSON_SetBoolValue plus test

* cJSON_Invalid insted of just 0

* Update tests/misc_tests.c

* VSCode standard C formater applied

Co-authored-by: Alan Wang <wp_scut@163.com>
2022-01-26 20:24:50 +08:00
65578af8cc Merge pull request #453 from Alanscut/add-return-value
add return value for  cJSON_AddItemTo... and cJSON_ReplaceItemxxx
2020-04-02 19:41:56 +08:00
f12cd7b701 Merge pull request #451 from Alanscut/20200324
add new function of `cJSON_SetValuestring`
2020-04-02 19:40:03 +08:00
97cf1d84e4 Add getNumberValue function
* Add GetNumberValue function and testcase

Co-authored-by: Alan Wang <wp_scut@163.com>
2020-04-02 19:36:35 +08:00
af56a146fd update testcase 2020-04-02 11:06:47 +08:00
bd7cbe9776 false has been redefined to cJSON_False 2020-04-01 19:19:00 +08:00
54d6b8016e add return value for cJSON_AddItemTo... 2020-03-26 14:18:52 +08:00
31c7880fab update cJSON_SetValuestring and testcase 2020-03-25 15:38:54 +08:00
4790c3c8f5 add testcase for cJSON_SetValuestringToObject 2020-03-24 22:28:27 +08:00
3ece4c893c Improve performance of adding item to array (#448)
* use prev pointer when adding item to array

Co-authored-by: xiaomianhehe <hongshaokai@hotmail.com>
Co-authored-by: Alanscut <scut@163.com>

Date:   Tue Feb 18 11:54:23 2020 +0800

* add testcase for cJSON_DeleteItemFromArray
2020-03-24 16:17:25 +08:00
9034a9cd0b Revert "use prev pointer when array do adding (#430)"
This reverts commit e8077d0150.
2020-03-16 23:04:39 +08:00
e8077d0150 use prev pointer when array do adding (#430)
* use prev pointer when array do adding
2020-02-18 11:54:23 +08:00
be749d7efa Fix crash of cJSON_GetObjectItemCaseSensitive when calling it on arrays 2018-12-16 11:06:40 +01:00
f25b8448e4 Support default __stdcall calling convention on tests as well 2018-09-12 15:32:30 -05:00
22a7d04fa0 add_item_to_object: Fix use-after-free when string is aliased
If the `string` property of the item that is added is an alias to the
`string` parameter of `add_item_to_object`, and `constant` is false,
`cJSON_strdup` would access the string after it has been freed.

Thanks @hhallen for reporting this in #248.
2018-03-02 19:49:55 +01:00
11844dd5a6 Add cJSON_Create{Array,Object}Reference 2017-11-28 03:06:02 +01:00
eaa90a6b74 Add cJSON_CreateStringReference 2017-11-28 02:02:55 +01:00
b2afbd3c9f cJSON_GetStringValue 2017-11-15 18:47:49 +01:00
97d7347a6e Merge branch 'develop' 2017-10-08 22:05:02 +02:00
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
5baa77f86c cJSON_Parse{,WithOpts}: Skip UTF-8 (Byte Order Marks) 2017-07-03 22:28:04 +02:00
bdd5ff7ad6 misc_tests: Call all functions with NULL pointers 2017-06-28 14:22:42 +02:00
9ecc96878f fix #174: cJSON_ReplaceItemInObject doesn't copy name 2017-05-22 22:55:05 +02:00
8b953d1202 Add cJSON_ReplaceItemViaPointer 2017-05-02 01:18:55 +02:00
c24c3e0285 Add cJSON_DetachItemViaPointer 2017-05-01 23:58:04 +02:00
28570ad095 Add test for cJSON_SetNumberHelper 2017-04-28 14:41:24 +02:00
e0d3a8a265 Limit nesting depth to 1000 and make it configurable. 2017-04-27 01:57:45 +02:00
c45dc12fd7 Tests for typecheck functions 2017-02-26 21:54:01 +01:00
56b819bfbc tests: test cJSON_GetObjectItem and cJSON_GetObjectItemCaseSensitive 2017-02-21 11:17:08 +01:00
cbbcc91498 tests: cJSON_ArrayForEach 2017-02-21 09:17:49 +01:00