165 Commits

Author SHA1 Message Date
mohaoyuan bb7792f80d 合入社区修改:fix: prevent NULL pointer dereference in cJSON_SetNumberHelper (#991)
Signed-off-by: mohaoyuan <mohaoyuan@h-partners.com>
2026-03-25 20:31:32 +08:00
mohaoyuan 781816e405 从社区合入版本1.7.19
Signed-off-by: mohaoyuan <mohaoyuan@h-partners.com>
2025-11-07 16:11:39 +08:00
liukaii dea6d9d184 Added max recusrion depth for cJSONDuplicate to prevent stack exhaustion in case of circular reference
Signed-off-by: liukaii <liukai240@huawei.com>
Change-Id: I8a9429686433c53e14edcd50bbf49a14eb9f9d6c
2025-07-24 15:21:21 +08:00
liuyuxiu fd06c3a5d1 tdd add
Signed-off-by: liuyuxiu <1175395694@qq.com>
2025-06-12 11:15:12 +08:00
liuyuxiu 5da3a048ef add tdd
Signed-off-by: liuyuxiu <1175395694@qq.com>
2025-06-11 10:49:04 +08:00
liuyuxiu d56a296582 revert bugfix
Signed-off-by: liuyuxiu <1175395694@qq.com>
2025-06-05 11:22:30 +08:00
liuyuxiu 40251b9666 bugfix
Signed-off-by: liuyuxiu <1175395694@qq.com>
2025-05-20 18:14:39 +08:00
youbing54 82d90be219 IssueNo: https://gitee.com/openharmony/third_party_cJSON/issues/IC7ESI
describe: 回退64位修改
Feature or Bugfix: Bugfix
Binary Source:Yes
Signed-off-by: youbing54<youbing3@huawei.com>
2025-05-13 14:30:05 +08:00
youbing54 8e9d81203b IssueNo: https://gitee.com/openharmony/third_party_cJSON/issues/IC740N
describe: CVE-2023-26819 代码回退
Feature or Bugfix: Bugfix
Binary Source:Yes
Signed-off-by: youbing54<youbing3@huawei.com>
2025-05-12 15:34:18 +08:00
jiangtao57 6689549a29 fix 【漏洞修复】 CVE-2023-26819
Signed-off-by: jiangtao57 <jiangtao57@huawei.com>
Change-Id: I34a9b7a2e4800aca7cc91635bd2414639f9c42de
2025-05-09 21:04:13 +08:00
borne 87569a8587 feat: add int64 support
Offering: Open Source Institute

This commit adds int64 support for cjson. To enable int64, you need to define the macro ENABLE_INT64. To make it more clear, you need to build cjson like this if you are using makefile:

mkdir build
cd build
cmake -DENABLE_INT64=ON ..
make

This implementation changed the type of valueint in struct cJSON: from int to long long(int64), and added a new flag cJSON_IsInt64.
For a int64 cJSON item, the value of item->type would be cJSON_Number | cJSON_IsInt64.

The existing functions parse_number and print_number can handle int64 now.

Considering we have added a new type cJSON_IsInt64, some new functions have been added:
CJSON_PUBLIC(long long *) cJSON_GetInt64NumberValue(cJSON * const item)
CJSON_PUBLIC(cJSON_bool) cJSON_IsInt64Number(const cJSON * const item)
CJSON_PUBLIC(cJSON *) cJSON_CreateInt64Number(long long integer)
CJSON_PUBLIC(cJSON*) cJSON_AddInt64NumberToObject(cJSON * const object, const char * const name, const long long integer)
CJSON_PUBLIC(long long) cJSON_SetInt64NumberValue(cJSON * const object, const long long integer)

And some existing functions are also adjusted for int64, including parse_number, cJSON_SetNumberHelper, print_number, cJSON_CreateNumber, cJSON_Compare and compare_json(in cJSON_Utils).

Besides the code changes, we have also added some testcases for int64.
These tests will run if ENABLE_INT64 is turned on.

Ref:PeterAlfredLee
https://github.com/DaveGamble/cJSON/pull/689

Signed-off-by: borne <bo.lu@huawei.com>
2024-06-21 13:05:42 +08:00
liubo 8c2fdf2ac6 Description: 漏洞处理
IssueNo:https://gitee.com/openharmony/third_party_cJSON/issues/I8S4Y8
Feature or Bugfix: Bugfix
Binary Source:No
Signed-off-by: liubo419 <liubo419@huawei.com>
2023-12-28 17:40:30 +08:00
w00845693 f1c9937639 Description: updata user guide
IssueNo: https://gitee.com/openharmony/third_party_cJSON/issues/I8JGFE
Feature or Bugfix: Feature
Binary Source:No
Signed-off-by: wyk99 <wangyuekai1@huawei.com>
2023-11-27 09:46:09 +08:00
huangxiaolinabc123 b8a1fbce1d modify samgr
Signed-off-by: huangxiaolinabc123 <huangxiaolin12@huawei.com>
Change-Id: Ida26129fe96f79d74996e6f22f6508ba4442dfb8
2022-07-30 15:25:13 +08:00
jiadexiang 6b94bd0906 Description: update version to v1.7.15
IssueNo:I5CE1Z
Feature or Bugfix: Feature
Binary Source:No

Signed-off-by: jiadexiang <jiadexiang@huawei.com>
2022-06-15 15:04:36 +08:00
jiadexiang cfaa0a85c2 Description: fix OAT by updating BUILD.gn
IssueNo:I44MMZ
Feature or Bugfix: Feature
Binary Source:No

Signed-off-by: jiadexiang <jiadexiang@huawei.com>
2021-08-09 21:15:36 +08:00
mamingshuai 8256a0a332 update openharmony 1.0.1 2021-03-11 20:34:23 +08:00
wenjun 03bfdbbcdf add OpenHarmony 1.0 baseline 2020-09-09 09:26:41 +08:00
l00495960 d974a83351 Merge tag 'v1.7.13' into hmf merge by version tool 2020-05-20 16:26:38 +08:00
p00452466 a70d1615ff TicketNo:DTS2020022300682
Description: foundations to foundation
Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source: NA
PrivateCode(Yes/No):No

Change-Id: I6f8539ffe2c38b71e50a66d3b6ec04d0ce9ed63e
Reviewed-on: http://mgit-tm.rnd.huawei.com/8314088
Tested-by: public jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: zhaopeng 00380337 <zhaopeng22@huawei.com>
Reviewed-by: yangguangzhao 00471801 <yangguangzhao1@huawei.com>
2020-04-02 20:57:42 +08:00
Alan Wang 23e4fbc639 Merge pull request #454 from Alanscut/float-compare
comparing double value with DBL_EPSILON
2020-04-02 20:09:42 +08:00
Alan Wang 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
Alan Wang f12cd7b701 Merge pull request #451 from Alanscut/20200324
add new function of `cJSON_SetValuestring`
2020-04-02 19:40:03 +08:00
Sang-Heon Jeon 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
caglarivriz 983bb2b4d6 Added cJSON_ParseWithLength (#358)
Co-authored-by: Caglar Ivriz <caglar.ivriz@siemens.com>
2020-04-02 19:24:36 +08:00
p00452466 21338afea4 TicketNo:DTS2020022300682
Description: foundations to foundation
Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source: NA
PrivateCode(Yes/No):No

Change-Id: I589f841278c9b8debb5ca44990a438e82015d780
Reviewed-on: http://mgit-tm.rnd.huawei.com/8311152
Tested-by: public jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: duyadong 00434757 <duyadong1@huawei.com>
Reviewed-by: zhaopeng 00380337 <zhaopeng22@huawei.com>
2020-04-02 19:06:31 +08:00
Alanscut 4e114c1f31 update testcase, fixes #433 2020-04-02 16:24:10 +08:00
Alanscut af56a146fd update testcase 2020-04-02 11:06:47 +08:00
Alanscut bd7cbe9776 false has been redefined to cJSON_False 2020-04-01 19:19:00 +08:00
h00294133 2eff7c1e99 TicketNo:AR000DVODQ
Description:Masking the compilation differences between m-core and a-core
Team:OTHERS
Feature or Bugfix:Feature
Binary Source:NA
PrivateCode(Yes/No):No

Change-Id: I3423868a51f510f7271b547d5809852a7e8cba7f
Reviewed-on: http://mgit-tm.rnd.huawei.com/8272772
Tested-by: public jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: wangjuntao 00221367 <wangjuntao.wang@huawei.com>
2020-03-31 19:05:03 +08:00
d00434757 6b7a0fcf54 TicketNo:AR000DSB8C
Description: Solve the compilation problem of test
Team:OTHERS
Feature or Bugfix:Feature
Binary Source:NA
PrivateCode(Yes/No):Yes

Change-Id: I744c883d21a3d19649724412435773e8cf9e4b52
Reviewed-on: http://mgit-tm.rnd.huawei.com/8231440
Tested-by: public jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: zhaopeng 00380337 <zhaopeng22@huawei.com>
2020-03-27 17:52:31 +08:00
Alanscut 54d6b8016e add return value for cJSON_AddItemTo... 2020-03-26 14:18:52 +08:00
Alanscut 31c7880fab update cJSON_SetValuestring and testcase 2020-03-25 15:38:54 +08:00
Alanscut 4790c3c8f5 add testcase for cJSON_SetValuestringToObject 2020-03-24 22:28:27 +08:00
Alan Wang 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
Alanscut d92c0de7e8 fix encode_string_as_pointer 2020-03-18 16:04:58 +08:00
h00294133 ee5b408cb1 TicketNo:AR000DVNIO
Description:lite test framework
Team:OTHERS
Feature or Bugfix:Feature
Binary Source:NA
PrivateCode(Yes/No):No

Change-Id: Iaba36922f0556ca0a42b7c149e53d5e0f7eb68dd
Reviewed-on: http://mgit-tm.rnd.huawei.com/8090244
Tested-by: public jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: wangjuntao 00221367 <wangjuntao.wang@huawei.com>
2020-03-17 14:13:43 +08:00
Alan Wang 9034a9cd0b Revert "use prev pointer when array do adding (#430)"
This reverts commit e8077d0150.
2020-03-16 23:04:39 +08:00
xiaomianhehe e8077d0150 use prev pointer when array do adding (#430)
* use prev pointer when array do adding
2020-02-18 11:54:23 +08:00
Alanscut 1f970e7db3 fix double comparison 2019-12-06 17:11:12 +08:00
Alanscut 446ff0d6cc fix issue#327 2019-11-28 09:56:04 +08:00
Alanscut 166c814cda eliminate warning when compiling cJSON 2019-08-12 17:06:29 +08:00
Max Bruckner 08d2bc766a Fix infinite loop in cJSON_Minify 2019-05-16 20:01:02 +02:00
Winterreise 19ff92da79 Add link dependency to fix tests link error when ENABLE_CJSON_UTILS is ON 2019-05-11 07:37:33 +08:00
Max Bruckner a43fa56a63 Rewrite cJSON_Minify, fixing buffer overflows, fixes #338
Also first tests for cJSON_Minify.
Thanks @bigric3 for reporting
2019-04-14 23:18:48 +02:00
Max Bruckner be749d7efa Fix crash of cJSON_GetObjectItemCaseSensitive when calling it on arrays 2018-12-16 11:06:40 +01:00
Max Bruckner 543ab5d08a Update json-patch-tests 2018-10-11 00:30:43 +02:00
Zach Hindes d9fe34bade Add newline to end of unity_setup.c 2018-09-17 09:10:20 -05:00
Zach Hindes f25b8448e4 Support default __stdcall calling convention on tests as well 2018-09-12 15:32:30 -05:00
Zach Hindes ad2cb5b7ea Enable build and test on Windows 2018-09-04 14:36:21 -05:00