Fixed defects

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
cjson-1.7.15-build/cJSON-1.7.15/tests/common.h:26: included_from: Included from here.
cjson-1.7.15-build/cJSON-1.7.15/tests/misc_tests.c:29: included_from: Included from here.
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:408:45: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘object’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1067:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1067:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:300:49: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1041:9: note: in expansion of macro ‘cannot_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1041:9: note: in expansion of macro ‘cannot_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1046:12: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1317:9: note: in expansion of macro ‘can_read’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1317:9: note: in expansion of macro ‘can_read’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1324:9: note: in expansion of macro ‘can_read’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1324:9: note: in expansion of macro ‘can_read’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1331:9: note: in expansion of macro ‘can_read’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1331:9: note: in expansion of macro ‘can_read’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1339:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1339:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1344:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1344:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1349:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1349:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1354:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1354:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1608:9: note: in expansion of macro ‘cannot_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:300:49: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1041:9: note: in expansion of macro ‘cannot_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1041:9: note: in expansion of macro ‘cannot_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1046:12: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:1615:9: note: in expansion of macro ‘can_access_at_index’
cjson-1.7.15-build/cJSON-1.7.15/tests/misc_tests.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/tests/misc_tests.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/tests/misc_tests.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c: scope_hint: In function ‘cJSON_SetValuestring’
cjson-1.7.15-build/cJSON-1.7.15/tests/misc_tests.c: scope_hint: In function ‘cJSON_SetValuestring’
#  406|           return NULL;
#  407|       }
#  408|->     if (strlen(valuestring) <= strlen(object->valuestring))
#  409|       {
#  410|           strcpy(object->valuestring, valuestring);

Error: CPPCHECK_WARNING (CWE-476): [#def2]
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:2274: warning[nullPointer]: Possible null pointer dereference: newitem
# 2272|       }
# 2273|   
# 2274|->     newitem->next = after_inserted;
# 2275|       newitem->prev = after_inserted->prev;
# 2276|       after_inserted->prev = newitem;

Error: CLANG_WARNING: [#def3]
cjson-1.7.15-build/cJSON-1.7.15/tests/misc_tests.c:29: included_from: Included from here.
cjson-1.7.15-build/cJSON-1.7.15/tests/common.h:26: included_from: Included from here.
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:2274:19: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'newitem')
# 2272|       }
# 2273|   
# 2274|->     newitem->next = after_inserted;
# 2275|       newitem->prev = after_inserted->prev;
# 2276|       after_inserted->prev = newitem;

Error: CPPCHECK_WARNING (CWE-476): [#def4]
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:2275: warning[nullPointer]: Possible null pointer dereference: newitem
# 2273|   
# 2274|       newitem->next = after_inserted;
# 2275|->     newitem->prev = after_inserted->prev;
# 2276|       after_inserted->prev = newitem;
# 2277|       if (after_inserted == array->child)

Error: CPPCHECK_WARNING (CWE-476): [#def5]
cjson-1.7.15-build/cJSON-1.7.15/cJSON.c:2277: warning[nullPointer]: Possible null pointer dereference: array
# 2275|       newitem->prev = after_inserted->prev;
# 2276|       after_inserted->prev = newitem;
# 2277|->     if (after_inserted == array->child)
# 2278|       {
# 2279|           array->child = newitem;

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-175.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namecjson-1.7.17-1.fc41
diffbase-store-results-to/tmp/tmpjq51a04b/cjson-1.7.17-1.fc41.tar.xz
diffbase-time-created2024-07-03 12:08:10
diffbase-time-finished2024-07-03 12:09:41
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpjq51a04b/cjson-1.7.17-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpjq51a04b/cjson-1.7.17-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-175.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namecjson-1.7.15-4.fc40
store-results-to/tmp/tmp9rutcck6/cjson-1.7.15-4.fc40.tar.xz
time-created2024-07-03 12:05:46
time-finished2024-07-03 12:07:42
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp9rutcck6/cjson-1.7.15-4.fc40.tar.xz' '--gcc-analyze' '/tmp/tmp9rutcck6/cjson-1.7.15-4.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9