cJSON
[Ported from github.com/DaveGamble/cJSON] Fix: heap-use-after-free in merge_patch when patch is subtree of target (#1065)
Brought by drakestapleton
cJSON / CHANGELOG.md
| 1 | 1.7.19 (Sep 9, 2025) |
| 2 | ====== |
| 3 | Fixes: |
| 4 | ------ |
| 5 | * Fix indentation (should use spaces), see #814 |
| 6 | * Fix spelling errors found by CodeSpell, see #841 |
| 7 | * Check for NULL in cJSON_DetachItemViaPointer, fixes #882, see #886 |
| 8 | * Fix #881, check overlap before calling strcpy in cJSON_SetValuestring, see #885 |
| 9 | * Fix #880 Max recursion depth for cJSON_Duplicate to prevent stack exhaustion, see #888 |
| 10 | * Allocate memory for the temporary buffer when paring numbers, see #939 |
| 11 | * fix the incorrect check in decode_array_index_from_pointer, see #957 |
| 12 | |
| 13 | 1.7.18 (May 13, 2024) |
| 14 | ====== |
| 15 | Fixes: |
| 16 | ------ |
| 17 | * Add NULL check to cJSON_SetValuestring()(CVE-2024-31755), see #839 and #840 |
| 18 | * Remove non-functional list handling of compiler flags, see #851 |
| 19 | * Fix heap buffer overflow, see #852 |
| 20 | * remove misused optimization flag -01, see #854 |
| 21 | * Set free'd pointers to NULL whenever they are not reassigned immediately after, see #855 and #833 |
| 22 | |
| 23 | 1.7.17 (Dec 26, 2023) |
| 24 | ====== |
| 25 | Fixes: |
| 26 | ------ |
| 27 | * Fix null reference in cJSON_SetValuestring(CVE-2023-50472), see #809 |
| 28 | * Fix null reference in cJSON_InsertItemInArray(CVE-2023-50471), see #809 and #810 |
| 29 | |
| 30 | 1.7.16 (Jul 5, 2023) |
| 31 | ====== |
| 32 | Features: |
| 33 | ------ |
| 34 | * Add an option for ENABLE_CJSON_VERSION_SO in CMakeLists.txt, see #534 |
| 35 | * Add cmake_policy to CMakeLists.txt, see #163 |
| 36 | * Add cJSON_SetBoolValue, see #639 |
| 37 | * Add meson documentation, see #761 |
| 38 | |
| 39 | Fixes: |
| 40 | ------ |
| 41 | * Fix memory leak in merge_patch, see #611 |
| 42 | * Fix conflicting target names 'uninstall', see #617 |
| 43 | * Bump cmake version to 3.0 and use new version syntax, see #587 |
| 44 | * Print int without decimal places, see #630 |
| 45 | * Fix 'cjson_utils-static' target not exist, see #625 |
| 46 | * Add allocate check for replace_item_in_object, see #675 |
| 47 | * Fix a null pointer crash in cJSON_ReplaceItemViaPointer, see #726 |
| 48 | |
| 49 | 1.7.15 (Aug 25, 2021) |
| 50 | ====== |
| 51 | Fixes: |
| 52 | ------ |
| 53 | * Fix potential core dumped for strrchr, see [#546](https://github.com/DaveGamble/cJSON/pull/546) |
| 54 | * Fix null pointer crash in cJSON_CreateXxArray, see [#538](https://github.com/DaveGamble/cJSON/pull/538) |
| 55 | * Fix several null pointer problems on allocation failure, see [#526](https://github.com/DaveGamble/cJSON/pull/526) |
| 56 | * Fix a possible dereference of null pointer, see [#519](https://github.com/DaveGamble/cJSON/pull/519) |
| 57 | * Fix windows build failure about defining nan, see [#518](https://github.com/DaveGamble/cJSON/pull/518) |
| 58 | |
| 59 | 1.7.14 (Sep 3, 2020) |
| 60 | ====== |
| 61 | Fixes: |
| 62 | ------ |
| 63 | * optimize the way to find tail node, see [#503](https://github.com/DaveGamble/cJSON/pull/503) |
| 64 | * Fix WError error on macosx because NAN is a float. Thanks @sappo, see [#484](https://github.com/DaveGamble/cJSON/pull/484) |
| 65 | * Fix some bugs in detach and replace. Thanks @miaoerduo, see [#456](https://github.com/DaveGamble/cJSON/pull/456) |
| 66 | |
| 67 | 1.7.13 (Apr 2, 2020) |
| 68 | ====== |
| 69 | Features: |
| 70 | --------- |
| 71 | * add new API of cJSON_ParseWithLength without breaking changes. Thanks @caglarivriz, see [#358](https://github.com/DaveGamble/cJSON/pull/358) |
| 72 | * add new API of cJSON_GetNumberValue. Thanks @Intuition, see[#385](https://github.com/DaveGamble/cJSON/pull/385) |
| 73 | * add uninstall target function for CMake. See [#402](https://github.com/DaveGamble/cJSON/pull/402) |
| 74 | * Improve performance of adding item to array. Thanks @xiaomianhehe, see [#430](https://github.com/DaveGamble/cJSON/pull/430), [#448](https://github.com/DaveGamble/cJSON/pull/448) |
| 75 | * add new API of cJSON_SetValuestring, for changing the valuestring safely. See [#451](https://github.com/DaveGamble/cJSON/pull/451) |
| 76 | * add return value for cJSON_AddItemTo... and cJSON_ReplaceItem... (check if the operation successful). See [#453](https://github.com/DaveGamble/cJSON/pull/453) |
| 77 | |
| 78 | Fixes: |
| 79 | ------ |
| 80 | * Fix clang -Wfloat-equal warning. Thanks @paulmalovanyi, see [#368](https://github.com/DaveGamble/cJSON/pull/368) |
| 81 | * Fix make failed in mac os. See [#405](https://github.com/DaveGamble/cJSON/pull/405) |
| 82 | * Fix memory leak in cJSONUtils_FindPointerFromObjectTo. Thanks @andywolk for reporting, see [#414](https://github.com/DaveGamble/cJSON/issues/414) |
| 83 | * Fix bug in encode_string_as_pointer. Thanks @AIChangJiang for reporting, see [#439](https://github.com/DaveGamble/cJSON/issues/439) |
| 84 | |
| 85 | 1.7.12 (May 17, 2019) |
| 86 | ====== |
| 87 | Fixes: |
| 88 | ------ |
| 89 | * Fix infinite loop in `cJSON_Minify` (potential Denial of Service). Thanks @Alanscut for reporting, see [#354](https://github.com/DaveGamble/cJSON/issues/354) |
| 90 | * Fix link error for Visual Studio. Thanks @tan-wei, see [#352](https://github.com/DaveGamble/cJSON/pull/352). |
| 91 | * Undefine `true` and `false` for `cJSON_Utils` before redefining them. Thanks @raiden00pl, see [#347](https://github.com/DaveGamble/cJSON/pull/347). |
| 92 | |
| 93 | 1.7.11 (Apr 15, 2019) |
| 94 | ====== |
| 95 | Fixes: |
| 96 | ------ |
| 97 | * Fix a bug where cJSON_Minify could overflow it's buffer, both reading and writing. This is a security issue, see [#338](https://github.com/DaveGamble/cJSON/issues/338). Big thanks @bigric3 for reporting. |
| 98 | * Unset `true` and `false` macros before setting them if they exist. See [#339](https://github.com/DaveGamble/cJSON/issues/339), thanks @raiden00pl for reporting |
| 99 | |
| 100 | 1.7.10 (Dec 21, 2018) |
| 101 | ====== |
| 102 | Fixes: |
| 103 | ------ |
| 104 | * Fix package config file for `libcjson`. Thanks @shiluotang for reporting [#321](https://github.com/DaveGamble/cJSON/issues/321) |
| 105 | * Correctly split lists in `cJSON_Utils`'s merge sort. Thanks @andysCaplin for the fix [#322](https://github.com/DaveGamble/cJSON/issues/322) |
| 106 | |
| 107 | 1.7.9 (Dec 16, 2018) |
| 108 | ===== |
| 109 | Fixes: |
| 110 | ------ |
| 111 | * Fix a bug where `cJSON_GetObjectItemCaseSensitive` would pass a nullpointer to `strcmp` when called on an array, see [#315](https://github.com/DaveGamble/cJSON/issues/315). Thanks @yuweol for reporting. |
| 112 | * Fix error in `cJSON_Utils` where the case sensitivity was not respected, see [#317](https://github.com/DaveGamble/cJSON/pull/317). Thanks @yuta-oxo for fixing. |
| 113 | * Fix some warnings detected by the Visual Studio Static Analyzer, see [#307](https://github.com/DaveGamble/cJSON/pull/307). Thanks @bnason-nf |
| 114 | |
| 115 | 1.7.8 (Sep 22, 2018) |
| 116 | ====== |
| 117 | Fixes: |
| 118 | ------ |
| 119 | * cJSON now works with the `__stdcall` calling convention on Windows, see [#295](https://github.com/DaveGamble/cJSON/pull/295), thanks @zhindes for contributing |
| 120 | |
| 121 | 1.7.7 (May 22, 2018) |
| 122 | ===== |
| 123 | Fixes: |
| 124 | ------ |
| 125 | * Fix a memory leak when realloc fails, see [#267](https://github.com/DaveGamble/cJSON/issues/267), thanks @AlfieDeng for reporting |
| 126 | * Fix a typo in the header file, see [#266](https://github.com/DaveGamble/cJSON/pull/266), thanks @zhaozhixu |
| 127 | |
| 128 | 1.7.6 (Apr 13, 2018) |
| 129 | ===== |
| 130 | Fixes: |
| 131 | ------ |
| 132 | * Add `SONAME` to the ELF files built by the Makefile, see [#252](https://github.com/DaveGamble/cJSON/issues/252), thanks @YanhaoMo for reporting |
| 133 | * Add include guards and `extern "C"` to `cJSON_Utils.h`, see [#256](https://github.com/DaveGamble/cJSON/issues/256), thanks @daschfg for reporting |
| 134 | |
| 135 | Other changes: |
| 136 | * Mark the Makefile as deprecated in the README. |
| 137 | |
| 138 | 1.7.5 (Mar 23, 2018) |
| 139 | ===== |
| 140 | Fixes: |
| 141 | ------ |
| 142 | * Fix a bug in the JSON Patch implementation of `cJSON Utils`, see [#251](https://github.com/DaveGamble/cJSON/pull/251), thanks @bobkocisko. |
| 143 | |
| 144 | 1.7.4 (Mar 3, 2018) |
| 145 | ===== |
| 146 | Fixes: |
| 147 | ------ |
| 148 | * Fix potential use after free if the `string` parameter to `cJSON_AddItemToObject` is an alias of the `string` property of the object that is added,see [#248](https://github.com/DaveGamble/cJSON/issues/248). Thanks @hhallen for reporting. |
| 149 | |
| 150 | 1.7.3 (Feb 8, 2018) |
| 151 | ===== |
| 152 | Fixes: |
| 153 | ------ |
| 154 | * Fix potential double free, thanks @projectgus for reporting [#241](https://github.com/DaveGamble/cJSON/issues/241) |
| 155 | |
| 156 | 1.7.2 (Feb 6, 2018) |
| 157 | ===== |
| 158 | Fixes: |
| 159 | ------ |
| 160 | * Fix the use of GNUInstallDirs variables and the pkgconfig file. Thanks @zeerd for reporting [#240](https://github.com/DaveGamble/cJSON/pull/240) |
| 161 | |
| 162 | 1.7.1 (Jan 10, 2018) |
| 163 | ===== |
| 164 | Fixes: |
| 165 | ------ |
| 166 | * Fixed an Off-By-One error that could lead to an out of bounds write. Thanks @liuyunbin for reporting [#230](https://github.com/DaveGamble/cJSON/issues/230) |
| 167 | * Fixed two errors with buffered printing. Thanks @liuyunbin for reporting [#230](https://github.com/DaveGamble/cJSON/issues/230) |
| 168 | |
| 169 | 1.7.0 (Dec 31, 2017) |
| 170 | ===== |
| 171 | Features: |
| 172 | --------- |
| 173 | * Large rewrite of the documentation, see [#215](https://github.com/DaveGamble/cJSON/pull/215) |
| 174 | * Added the `cJSON_GetStringValue` function |
| 175 | * Added the `cJSON_CreateStringReference` function |
| 176 | * Added the `cJSON_CreateArrayReference` function |
| 177 | * Added the `cJSON_CreateObjectReference` function |
| 178 | * The `cJSON_Add...ToObject` macros are now functions that return a pointer to the added item, see [#226](https://github.com/DaveGamble/cJSON/pull/226) |
| 179 | |
| 180 | Fixes: |
| 181 | ------ |
| 182 | * Fix a problem with `GNUInstallDirs` in the CMakeLists.txt, thanks @yangfl, see [#210](https://github.com/DaveGamble/cJSON/pull/210) |
| 183 | * Fix linking the tests when building as static library, see [#213](https://github.com/DaveGamble/cJSON/issues/213) |
| 184 | * New overrides for the CMake option `BUILD_SHARED_LIBS`, see [#207](https://github.com/DaveGamble/cJSON/issues/207) |
| 185 | |
| 186 | Other Changes: |
| 187 | -------------- |
| 188 | * Readme: Explain how to include cJSON, see [#211](https://github.com/DaveGamble/cJSON/pull/211) |
| 189 | * Removed some trailing spaces in the code, thanks @yangfl, see [#212](https://github.com/DaveGamble/cJSON/pull/212) |
| 190 | * Updated [Unity](https://github.com/ThrowTheSwitch/Unity) and [json-patch-tests](https://github.com/json-patch/json-patch-tests) |
| 191 | |
| 192 | 1.6.0 (Oct 9, 2017) |
| 193 | ===== |
| 194 | Features: |
| 195 | --------- |
| 196 | * You can now build cJSON as both shared and static library at once with CMake using `-DBUILD_SHARED_AND_STATIC_LIBS=On`, see [#178](https://github.com/DaveGamble/cJSON/issues/178) |
| 197 | * UTF-8 byte order marks are now ignored, see [#184](https://github.com/DaveGamble/cJSON/issues/184) |
| 198 | * Locales can now be disabled with the option `-DENABLE_LOCALES=Off`, see [#202](https://github.com/DaveGamble/cJSON/issues/202), thanks @Casperinous |
| 199 | * Better support for MSVC and Visual Studio |
| 200 | |
| 201 | Other Changes: |
| 202 | -------------- |
| 203 | * Add the new warnings `-Wswitch-enum`, `-Wused-but-makred-unused`, `-Wmissing-variable-declarations`, `-Wunused-macro` |
| 204 | * More number printing tests. |
| 205 | * Continuous integration testing with AppVeyor (semi automatic at this point), thanks @simon-p-r |
| 206 | |
| 207 | 1.5.9 (Sep 8, 2017) |
| 208 | ===== |
| 209 | Fixes: |
| 210 | ------ |
| 211 | * Set the global error pointer even if `return_parse_end` is passed to `cJSON_ParseWithOpts`, see [#200](https://github.com/DaveGamble/cJSON/pull/200), thanks @rmallins |
| 212 | |
| 213 | 1.5.8 (Aug 21, 2017) |
| 214 | ===== |
| 215 | Fixes: |
| 216 | ------ |
| 217 | * Fix `make test` in the Makefile, thanks @YanhaoMo for reporting this [#195](https://github.com/DaveGamble/cJSON/issues/195) |
| 218 | |
| 219 | 1.5.7 (Jul 13, 2017) |
| 220 | ===== |
| 221 | Fixes: |
| 222 | ------ |
| 223 | * Fix a bug where realloc failing would return a pointer to an invalid memory address. This is a security issue as it could potentially be used by an attacker to write to arbitrary memory addresses, see [#189](https://github.com/DaveGamble/cJSON/issues/189), fixed in [954d61e](https://github.com/DaveGamble/cJSON/commit/954d61e5e7cb9dc6c480fc28ac1cdceca07dd5bd), big thanks @timothyjohncarney for reporting this issue |
| 224 | * Fix a spelling mistake in the AFL fuzzer dictionary, see [#185](https://github.com/DaveGamble/cJSON/pull/185), thanks @jwilk |
| 225 | |
| 226 | 1.5.6 (Jun 28, 2017) |
| 227 | ===== |
| 228 | Fixes: |
| 229 | ------ |
| 230 | * Make cJSON a lot more tolerant about passing NULL pointers to its functions, it should now fail safely instead of dereferencing the pointer, see [#183](https://github.com/DaveGamble/cJSON/pull/183). Thanks @msichal for reporting [#182](https://github.com/DaveGamble/cJSON/issues/182) |
| 231 | |
| 232 | 1.5.5 (Jun 15, 2017) |
| 233 | ===== |
| 234 | Fixes: |
| 235 | ------ |
| 236 | * Fix pointers to nested arrays in cJSON_Utils, see [9abe](https://github.com/DaveGamble/cJSON/commit/9abe75e072050f34732a7169740989a082b65134) |
| 237 | * Fix an error with case sensitivity handling in cJSON_Utils, see [b9cc911](https://github.com/DaveGamble/cJSON/commit/b9cc911831b0b3e1bb72f142389428e59f882b38) |
| 238 | * Fix cJSON_Compare for arrays that are prefixes of the other and objects that are a subset of the other, see [03ba72f](https://github.com/DaveGamble/cJSON/commit/03ba72faec115160d1f3aea5582d9b6af5d3e473) and [#180](https://github.com/DaveGamble/cJSON/issues/180), thanks @zhengqb for reporting |
| 239 | |
| 240 | 1.5.4 (Jun 5, 2017) |
| 241 | ====== |
| 242 | Fixes: |
| 243 | ------ |
| 244 | * Fix build with GCC 7.1.1 and optimization level `-O2`, see [bfbd8fe](https://github.com/DaveGamble/cJSON/commit/bfbd8fe0d85f1dd21e508748fc10fc4c27cc51be) |
| 245 | |
| 246 | Other Changes: |
| 247 | -------------- |
| 248 | * Update [Unity](https://github.com/ThrowTheSwitch/Unity) to 3b69beaa58efc41bbbef70a32a46893cae02719d |
| 249 | |
| 250 | 1.5.3 (May 23, 2017) |
| 251 | ===== |
| 252 | Fixes: |
| 253 | ------ |
| 254 | * Fix `cJSON_ReplaceItemInObject` not keeping the name of an item, see [#174](https://github.com/DaveGamble/cJSON/issues/174) |
| 255 | |
| 256 | 1.5.2 (May 10, 2017) |
| 257 | ===== |
| 258 | Fixes: |
| 259 | ------ |
| 260 | * Fix a reading buffer overflow in `parse_string`, see [a167d9e](https://github.com/DaveGamble/cJSON/commit/a167d9e381e5c84bc03de4e261757b031c0c690d) |
| 261 | * Fix compiling with -Wcomma, see [186cce3](https://github.com/DaveGamble/cJSON/commit/186cce3ece6ce6dfcb58ac8b2a63f7846c3493ad) |
| 262 | * Remove leftover attribute from tests, see [b537ca7](https://github.com/DaveGamble/cJSON/commit/b537ca70a35680db66f1f5b8b437f7114daa699a) |
| 263 | |
| 264 | 1.5.1 (May 6, 2017) |
| 265 | ===== |
| 266 | Fixes: |
| 267 | ------ |
| 268 | * Add gcc version guard to the Makefile, see [#164](https://github.com/DaveGamble/cJSON/pull/164), thanks @juvasquezg |
| 269 | * Fix incorrect free in `cJSON_Utils` if custom memory allocator is used, see [#166](https://github.com/DaveGamble/cJSON/pull/166), thanks @prefetchnta |
| 270 | |
| 271 | 1.5.0 (May 2, 2017) |
| 272 | ===== |
| 273 | Features: |
| 274 | * cJSON finally prints numbers without losing precision, see [#153](https://github.com/DaveGamble/cJSON/pull/153), thanks @DeboraG |
| 275 | * `cJSON_Compare` recursively checks if two cJSON items contain the same values, see [#148](https://github.com/DaveGamble/cJSON/pull/148) |
| 276 | * Provide case sensitive versions of every function where it matters, see [#158](https://github.com/DaveGamble/cJSON/pull/158) and [#159](https://github.com/DaveGamble/cJSON/pull/159) |
| 277 | * Added `cJSON_ReplaceItemViaPointer` and `cJSON_DetachItemViaPointer` |
| 278 | * Added `cJSON_free` and `cJSON_malloc` that expose the internal configured memory allocators. see [02a05ee](https://github.com/DaveGamble/cJSON/commit/02a05eea4e6ba41811f130b322660bea8918e1a0) |
| 279 | |
| 280 | |
| 281 | Enhancements: |
| 282 | ------------- |
| 283 | * Parse into a buffer, this will allow parsing `\u0000` in the future (not quite yet though) |
| 284 | * General simplifications and readability improvements |
| 285 | * More unit tests |
| 286 | * Update [unity](https://github.com/ThrowTheSwitch/Unity) testing library to 2.4.1 |
| 287 | * Add the [json-patch-tests](https://github.com/json-patch/json-patch-tests) test suite to test cJSON_Utils. |
| 288 | * Move all tests from `test_utils.c` to unit tests with unity. |
| 289 | |
| 290 | Fixes: |
| 291 | ------ |
| 292 | * Fix some warnings with the Microsoft compiler, see [#139](https://github.com/DaveGamble/cJSON/pull/139), thanks @PawelWMS |
| 293 | * Fix several bugs in cJSON_Utils, mostly found with [json-patch-tests](https://github.com/json-patch/json-patch-tests) |
| 294 | * Prevent a stack overflow by specifying a maximum nesting depth `CJSON_NESTING_LIMIT` |
| 295 | |
| 296 | Other Changes: |
| 297 | -------------- |
| 298 | * Move generated files in the `library_config` subdirectory. |
| 299 | |
| 300 | 1.4.7 (Apr 19, 2017) |
| 301 | ===== |
| 302 | Fixes: |
| 303 | ------ |
| 304 | * Fix `cJSONUtils_ApplyPatches`, it was completely broken and apparently nobody noticed (or at least reported it), see [075a06f](https://github.com/DaveGamble/cJSON/commit/075a06f40bdc4f836c7dd7cad690d253a57cfc50) |
| 305 | * Fix inconsistent prototype for `cJSON_GetObjectItemCaseSensitive`, see [51d3df6](https://github.com/DaveGamble/cJSON/commit/51d3df6c9f7b56b860c8fb24abe7bab255cd4fa9), thanks @PawelWMS |
| 306 | |
| 307 | 1.4.6 (Apr 9, 2017) |
| 308 | ===== |
| 309 | Fixes: |
| 310 | ------ |
| 311 | * Several corrections in the README |
| 312 | * Making clear that `valueint` should not be written to |
| 313 | * Fix overflow detection in `ensure`, see [2683d4d](https://github.com/DaveGamble/cJSON/commit/2683d4d9873df87c4bdccc523903ddd78d1ad250) |
| 314 | * Fix a potential null pointer dereference in cJSON_Utils, see [795c3ac](https://github.com/DaveGamble/cJSON/commit/795c3acabed25c9672006b2c0f40be8845064827) |
| 315 | * Replace incorrect `sizeof('\0')` with `sizeof("")`, see [84237ff](https://github.com/DaveGamble/cJSON/commit/84237ff48e69825c94261c624eb0376d0c328139) |
| 316 | * Add caveats section to the README, see [50b3c30](https://github.com/DaveGamble/cJSON/commit/50b3c30dfa89830f8f477ce33713500740ac3b79) |
| 317 | * Make cJSON locale independent, see [#146](https://github.com/DaveGamble/cJSON/pull/146), Thanks @peterh for reporting |
| 318 | * Fix compiling without CMake with MSVC, see [#147](https://github.com/DaveGamble/cJSON/pull/147), Thanks @dertuxmalwieder for reporting |
| 319 | |
| 320 | 1.4.5 (Mar 28, 2017) |
| 321 | ===== |
| 322 | Fixes: |
| 323 | ------ |
| 324 | * Fix bug in `cJSON_SetNumberHelper`, thanks @mmkeeper, see [#138](https://github.com/DaveGamble/cJSON/issues/138) and [ef34500](https://github.com/DaveGamble/cJSON/commit/ef34500693e8c4a2849d41a4bd66fd19c9ec46c2) |
| 325 | * Workaround for internal compiler error in GCC 5.4.0 and 6.3.1 on x86 (2f65e80a3471d053fdc3f8aed23d01dd1782a5cb [GCC bugreport](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80097)) |
| 326 | |
| 327 | 1.4.4 (Mar 24, 2017) |
| 328 | ===== |
| 329 | Fixes: |
| 330 | ------ |
| 331 | * Fix a theoretical integer overflow, (not sure if it is possible on actual hardware), see [e58f7ec](https://github.com/DaveGamble/cJSON/commit/e58f7ec027d00b7cdcbf63e518c1b5268b29b3da) |
| 332 | * Fix an off by one error, see [cc84a44](https://github.com/DaveGamble/cJSON/commit/cc84a446be20cc283bafdc4d94c050ba1111ac02), thanks @gatzka |
| 333 | * Double check the offset of the print buffer in `ensure`, see [1934059](https://github.com/DaveGamble/cJSON/commit/1934059554b9a0971e00f79e96900f422cfdd114) |
| 334 | |
| 335 | Improvements: |
| 336 | * Add a note in the header about required buffer size when using `cJSON_PrintPreallocated`, see [4bfb8800](https://github.com/DaveGamble/cJSON/commit/4bfb88009342fb568295a7f6dc4b7fee74fbf022) |
| 337 | |
| 338 | 1.4.3 (Mar 19, 2017) |
| 339 | ===== |
| 340 | Fixes: |
| 341 | ------ |
| 342 | * Fix compilation of the tests on 32 bit PowerPC and potentially other systems, see [4ec6e76](https://github.com/DaveGamble/cJSON/commit/4ec6e76ea2eec16f54b58e8c95b4c734e59481e4) |
| 343 | * Fix compilation with old GCC compilers (4.3+ were tested), see [227d33](https://github.com/DaveGamble/cJSON/commit/227d3398d6b967879761ebe02c1b63dbd6ea6e0d), [466eb8e](https://github.com/DaveGamble/cJSON/commit/466eb8e3f8a65080f2b3ca4a79ab7b72bd539dba), see also [#126](https://github.com/DaveGamble/cJSON/issues/126) |
| 344 | |
| 345 | 1.4.2 (Mar 16, 2017) |
| 346 | ===== |
| 347 | Fixes: |
| 348 | ------ |
| 349 | * Fix minimum required cmake version, see [30e1e7a](https://github.com/DaveGamble/cJSON/commit/30e1e7af7c63db9b55f5a3cda977a6c032f0b132) |
| 350 | * Fix detection of supported compiler flags, see [76e5296](https://github.com/DaveGamble/cJSON/commit/76e5296d0d05ceb3018a9901639e0e171b44a557) |
| 351 | * Run `cJSON_test` and `cJSON_test_utils` along with unity tests, see [c597601](https://github.com/DaveGamble/cJSON/commit/c597601cf151a757dcf800548f18034d4ddfe2cb) |
| 352 | |
| 353 | 1.4.1 (Mar 16, 2017) |
| 354 | ===== |
| 355 | Fixes: |
| 356 | ------ |
| 357 | * Make `print_number` abort with a failure in out of memory situations, see [cf1842](https://github.com/DaveGamble/cJSON/commit/cf1842dc6f64c49451a022308b4415e4d468be0a) |
| 358 | |
| 359 | 1.4.0 (Mar 4, 2017) |
| 360 | ===== |
| 361 | Features |
| 362 | -------- |
| 363 | * Functions to check the type of an item, see [#120](https://github.com/DaveGamble/cJSON/pull/120) |
| 364 | * Use dllexport on windows and fvisibility on Unix systems for public functions, see [#116](https://github.com/DaveGamble/cJSON/pull/116), thanks @mjerris |
| 365 | * Remove trailing zeroes from printed numbers, see [#123](https://github.com/DaveGamble/cJSON/pull/123) |
| 366 | * Expose the internal boolean type `cJSON_bool` in the header, see [2d3520e](https://github.com/DaveGamble/cJSON/commit/2d3520e0b9d0eb870e8886e8a21c571eeddbb310) |
| 367 | |
| 368 | Fixes |
| 369 | * Fix handling of NULL pointers in `cJSON_ArrayForEach`, see [b47d0e3](https://github.com/DaveGamble/cJSON/commit/b47d0e34caaef298edfb7bd09a72cfff21d231ff) |
| 370 | * Make it compile with GCC 7 (fix -Wimplicit-fallthrough warning), see [9d07917](https://github.com/DaveGamble/cJSON/commit/9d07917feb1b613544a7513d19233d4c851ad7ad) |
| 371 | |
| 372 | Other Improvements |
| 373 | * internally use realloc if available ([#110](https://github.com/DaveGamble/cJSON/pull/110)) |
| 374 | * builtin support for fuzzing with [afl](http://lcamtuf.coredump.cx/afl/) ([#111](https://github.com/DaveGamble/cJSON/pull/111)) |
| 375 | * unit tests for the print functions ([#112](https://github.com/DaveGamble/cJSON/pull/112)) |
| 376 | * Always use buffered printing ([#113](https://github.com/DaveGamble/cJSON/pull/113)) |
| 377 | * simplify the print functions ([#114](https://github.com/DaveGamble/cJSON/pull/114)) |
| 378 | * Add the compiler flags `-Wdouble-conversion`, `-Wparentheses` and `-Wcomma` ([#122](https://github.com/DaveGamble/cJSON/pull/122)) |
| 379 | |
| 380 | 1.3.2 (Mar 1, 2017) |
| 381 | ===== |
| 382 | Fixes: |
| 383 | ------ |
| 384 | * Don't build the unity library if testing is disabled, see [#121](https://github.com/DaveGamble/cJSON/pull/121). Thanks @ffontaine |
| 385 | |
| 386 | 1.3.1 (Feb 27, 2017) |
| 387 | ===== |
| 388 | Fixes: |
| 389 | ------ |
| 390 | * Bugfix release that fixes an out of bounds read, see [#118](https://github.com/DaveGamble/cJSON/pull/118). This shouldn't have any security implications. |
| 391 | |
| 392 | 1.3.0 (Feb 17, 2017) |
| 393 | ===== |
| 394 | 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. |
| 395 | |
| 396 | Features: |
| 397 | * New type for cJSON structs: `cJSON_Invalid`, see [#108](https://github.com/DaveGamble/cJSON/pull/108) |
| 398 | |
| 399 | Fixes: |
| 400 | ------ |
| 401 | * runtime checks for a lot of potential integer overflows |
| 402 | * fix incorrect return in cJSON_PrintBuffered [cf9d57d](https://github.com/DaveGamble/cJSON/commit/cf9d57d56cac21fc59465b8d26cf29bf6d2a87b3) |
| 403 | * fix several potential issues found by [Coverity](https://scan.coverity.com/projects/cjson) |
| 404 | * fix potentially undefined behavior when assigning big numbers to `valueint` ([41e2837](https://github.com/DaveGamble/cJSON/commit/41e2837df1b1091643aff073f2313f6ff3cc10f4)) |
| 405 | * 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). |
| 406 | * fix the `cJSON_SetNumberValue` macro ([87f7727](https://github.com/DaveGamble/cJSON/commit/87f77274de6b3af00fb9b9a7f3b900ef382296c2)), this slightly changes the behavior, see commit message |
| 407 | |
| 408 | Introduce unit tests |
| 409 | -------------------- |
| 410 | |
| 411 | * Started writing unit tests with the [Cunity](https://github.com/ThrowTheSwitch/Unity) testing framework. Currently this covers the parser functions. |
| 412 | |
| 413 | Also: |
| 414 | * Support for running the tests with [Valgrind](http://valgrind.org) |
| 415 | * Support for compiling the tests with [AddressSanitizer](https://github.com/google/sanitizers) and [UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html). |
| 416 | * `travis.yml` file for running unit tests on travis. (not enabled for the repository yet though [#102](https://github.com/DaveGamble/cJSON/issues/102) |
| 417 | |
| 418 | Simplifications |
| 419 | --------------- |
| 420 | |
| 421 | 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. |
| 422 | * Use `strtod` from the standard library for parsing numbers ([0747669](https://github.com/DaveGamble/cJSON/commit/074766997246481dfc72bfa78f07898a2716473f)) |
| 423 | * Use goto-fail in several parser functions ([#100](https://github.com/DaveGamble/cJSON/pull/100)) |
| 424 | * Rewrite/restructure all of the parsing functions to be easier to understand and have less code paths doing the same as another. ([#109](https://github.com/DaveGamble/cJSON/pull/109)) |
| 425 | * Simplify the buffer allocation strategy to always doubling the needed amount ([9f6fa94](https://github.com/DaveGamble/cJSON/commit/9f6fa94c91a87b71e4c6868dbf2ce431a48517b0)) |
| 426 | * Combined `cJSON_AddItemToObject` and `cJSON_AddItemToObjectCS` to one function ([cf862d](https://github.com/DaveGamble/cJSON/commit/cf862d0fed7f9407e4b046d78d3d8050d2080d12)) |
| 427 | |
| 428 | Other changes |
| 429 | ------------- |
| 430 | * Prevent the usage of incompatible C and header versions via preprocessor directive ([123bb1](https://github.com/DaveGamble/cJSON/commit/123bb1af7bfae41d805337fef4b41045ef6c7d25)) |
| 431 | * Let CMake automatically detect compiler flags |
| 432 | * Add new compiler flags (`-Wundef`, `-Wswitch-default`, `-Wconversion`, `-fstack-protector-strong`) ([#98](https://github.com/DaveGamble/cJSON/pull/98)) |
| 433 | * Change internal sizes from `int` to `size_t` ([ecd5678](https://github.com/DaveGamble/cJSON/commit/ecd5678527a6bc422da694e5be9e9979878fe6a0)) |
| 434 | * Change internal strings from `char*` to `unsigned char*` ([28b9ba4](https://github.com/DaveGamble/cJSON/commit/28b9ba4334e0f7309e867e874a31f395c0ac2474)) |
| 435 | * Add `const` in more places |
| 436 | |
| 437 | 1.2.1 (Jan 31, 2017) |
| 438 | ===== |
| 439 | Fixes: |
| 440 | ------ |
| 441 | * Fixes a potential null pointer dereference in cJSON_Utils, discovered using clang's static analyzer by @bnason-nf, see [#96](https://github.com/DaveGamble/cJSON/issues/96) |
| 442 | |
| 443 | 1.2.0 (Jan 9, 2017) |
| 444 | ===== |
| 445 | Features: |
| 446 | --------- |
| 447 | * Add a new type of cJSON item for raw JSON and support printing it. Thanks @loigu, see [#65](https://github.com/DaveGamble/cJSON/pull/65), [#90](https://github.com/DaveGamble/cJSON/pull/90) |
| 448 | |
| 449 | Fixes: |
| 450 | ------ |
| 451 | * Compiler warning if const is casted away, Thanks @gatzka, see [#83](https://github.com/DaveGamble/cJSON/pull/83) |
| 452 | * Fix compile error with strict-overflow on PowerPC, see [#85](https://github.com/DaveGamble/cJSON/issues/85) |
| 453 | * Fix typo in the README, thanks @MicroJoe, see [#88](https://github.com/DaveGamble/cJSON/pull/88) |
| 454 | * Add compile flag for compatibility with C++ compilers |
| 455 | |
| 456 | 1.1.0 (Dec 6, 2016) |
| 457 | ===== |
| 458 | * Add a function `cJSON_PrintPreallocated` to print to a preallocated buffer, thanks @ChisholmKyle, see [#72](https://github.com/DaveGamble/cJSON/pull/72) |
| 459 | * More compiler warnings when using Clang or GCC, thanks @gatzka, see [#75](https://github.com/DaveGamble/cJSON/pull/75), [#78](https://github.com/DaveGamble/cJSON/pull/78) |
| 460 | * fixed a memory leak in `cJSON_Duplicate`, thanks @alperakcan, see [#81](https://github.com/DaveGamble/cJSON/pull/81) |
| 461 | * fix the `ENABLE_CUSTOM_COMPILER_FLAGS` cmake option |
| 462 | |
| 463 | 1.0.2 (Nov 25, 2016) |
| 464 | ===== |
| 465 | * Rename internal boolean type, see [#71](https://github.com/DaveGamble/cJSON/issues/71). |
| 466 | |
| 467 | 1.0.1 (Nov 20, 2016) |
| 468 | ===== |
| 469 | Small bugfix release. |
| 470 | * Fixes a bug with the use of the cJSON structs type in cJSON_Utils, see [d47339e](https://github.com/DaveGamble/cJSON/commit/d47339e2740360e6e0994527d5e4752007480f3a) |
| 471 | * improve code readability |
| 472 | * initialize all variables |
| 473 | |
| 474 | 1.0.0 (Nov 17, 2016) |
| 475 | ===== |
| 476 | 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. |