Skip to content

Releases: DaveGamble/cJSON

1.3.0

17 Feb 00:49
Compare
Choose a tag to compare

This release includes a lot of rework in the parser and includes the Cunity unit testing framework, as well as some fixes. I increased the minor version number because there were quite a lot of internal changes.

Features:

  • New type for cJSON structs: cJSON_Invalid (#108)

Fixes:

  • runtime checks for a lot of potential integer overflows
  • fix incorrect return in cJSON_PrintBuffered (cf9d57d)
  • fix several potential issues found by Coverity
  • fix potentially undefined behavior when assigning big numbers to valueint (41e2837)
    • Numbers exceeding INT_MAX or lower than INT_MIN will be explicitly assigned to valueint as INT_MAX and INT_MIN respectively (saturation on overflow).
    • fix the cJSON_SetNumberValue macro (87f7727), this slightly changes the behavior, see commit message

Introduce unit tests

Started writing unit tests with the Cunity testing framework. Currently this covers the parser functions.

Also:

Simplifications

After having unit tests for the parser function in place, I started refactoring the parser functions (as well as others) and making them easier to read and maintain.

  • Use strtod from the standard library for parsing numbers (0747669)
  • Use goto-fail in several parser functions (#100)
  • Rewrite/restructure all of the parsing functions to be easier to understand and have less code paths doing the same as another. (#109)
  • Simplify the buffer allocation strategy to always doubling the needed amount (9f6fa94)
  • Combined cJSON_AddItemToObject and cJSON_AddItemToObjectCS to one function (cf862d0)

Other changes

  • Prevent the usage of incompatible C and header versions via preprocessor directive (123bb1a)
  • Let CMake automatically detect compiler flags
  • Add new compiler flags (-Wundef, -Wswitch-default, -Wconversion, -fstack-protector-strong) (#98)
  • Change internal sizes from int to size_t (ecd5678)
  • Change internal strings from char* to unsigned char* (28b9ba4)
  • Add const in more places

1.2.1

30 Jan 18:39
Compare
Choose a tag to compare

Fixes:

  • Fixes a potential null pointer dereference in cJSON_Utils, discovered using clang's static analyzer by @bnason-nf (#96)

1.2.0

09 Jan 11:36
Compare
Choose a tag to compare

Features:

  • Add a new type of cJSON item for raw JSON and support printing it. Thanks @loigu (#65, #90)

Fixes:

  • Compiler warning if const is casted away, Thanks @gatzka (#83)
  • Fix compile error with strict-overflow on PowerPC, (#85)
  • Fix typo in the README, thanks @MicroJoe (#88)
  • Add compile flag for compatibility with C++ compilers

1.1.0

06 Dec 02:08
Compare
Choose a tag to compare
  • Add a function cJSON_PrintPreallocated to print to a preallocated buffer, thanks @ChisholmKyle (#72)
  • More compiler warnings when using Clang or GCC, thanks @gatzka (#75, #78)
  • fixed a memory leak in cJSON_Duplicate, thanks @alperakcan (#81)
  • fix the ENABLE_CUSTOM_COMPILER_FLAGS cmake option

1.0.2

25 Nov 01:26
Compare
Choose a tag to compare

Rename internal boolean type, see #71.

1.0.1

19 Nov 18:13
Compare
Choose a tag to compare

Small bugfix release.

  • Fixes a bug with the use of the cJSON structs type in cJSON_Utils, see d47339e
  • improve code readability
  • initialize all variables

First release 1.0.0

17 Nov 01:20
Compare
Choose a tag to compare

This is the first official versioned release of cJSON. It provides an API version for the shared library and improved Makefile and CMake build files.

v0.0.0

12 Nov 06:28
Compare
Choose a tag to compare
v0.0.0 Pre-release
Pre-release
fix #55 memory leak in cJSON_ReplaceItemInObject