cJSON icon indicating copy to clipboard operation
cJSON copied to clipboard

The else branch of the add_item_to_array function affects the function. Apply for the community to roll back this code.

Open limingjuan00 opened this issue 3 years ago • 3 comments

1.Problem Description: The else branch of the add_item_to_array function is available in version 1.7.13. In version 1.7.14, this code is deleted, affecting basic functions. The community modification that affects the function is:https://github.com/DaveGamble/cJSON/pull/503/files The code is modified as follows: image 2.Application Scenario: This is a device-cloud synergy scenario: (1) The cloud uses the open-source third-party software com.fasterxml.jackson.databind 2.10.5 to construct a JSON interface message format of HTTPS/HTTP as a request. (2) After the device receives a request message from the cloud, The CJSON 1.7.14 software is used to parse the message in the request and process the response. After the processing, the backend uses the CJSON 1.7.14 software to construct a response message and send the response message to the cloud. 3) The cloud uses the com.fasterxml.jackson.databind 2.10.5 to parse the response message and determine whether the response message is expected.

After this code segment is deleted, the response message data received by the cloud is changed and the data is lost, affecting service functions.

3.Suggestions We suggest revert this modification.

4.Contact: [email protected][email protected][email protected]

limingjuan00 avatar Mar 15 '22 09:03 limingjuan00

Could you provide a minimal repoducible use case?

Alanscut avatar Mar 28 '22 12:03 Alanscut

抱歉,我这里不太好提供最小复现用例,报错不是我这里,是云端服务器收到我这里用cJSON软件构造的消息解析字段异常了,云端服务器用的是com.fasterxml.jackson.databind 2.10.5的java软件包解析的,我们的使用场景比较特殊。

Sorry, I cannot provide the minimum recurrence cases. The error is not reported here. The cloud server receives the message parsing field constructed by the cJSON software. The cloud server parses the message using the Java software package of com.fasterxml.jackson.databind 2.10.5. The application scenario is special.

limingjuan00 avatar Mar 29 '22 09:03 limingjuan00

@limingjuan00 are you able to construct a simple program that builds a json array using both old and new versions of the code and identifies a difference in the printed json? Or perhaps can you capture an example json array that is sent to the cloud server which appears not to be parsed correctly by the cloud server? I've been using the latest version of cJSON and it seems to build json arrays correctly.

mbratch avatar Apr 29 '22 11:04 mbratch