json-c-0.18-1.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c: scope_hint: In function ‘json_object_object_add_ex’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:585:24: warning[-Wanalyzer-malloc-leak]: leak of ‘k’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/linkhash.h:388:16: note: in expansion of macro ‘_LH_UNCONST’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c: scope_hint: In function ‘json_object_object_add_ex’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/linkhash.h:388:16: note: in expansion of macro ‘_LH_UNCONST’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c: scope_hint: In function ‘json_object_object_add_ex’
#  583|   		if (k == NULL)
#  584|   			return -1;
#  585|-> 		return lh_table_insert_w_hash(JC_OBJECT(jso)->c_object, k, val, hash, opts);
#  586|   	}
#  587|   	existing_value = (json_object *)lh_entry_v(existing_entry);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
json-c-0.18-build/json-c-json-c-0.18-20240915/json_tokener.c: scope_hint: In function ‘json_tokener_parse_ex’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_tokener.c:1223:44: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(*tok_730(D)->pb.buf)’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_tokener.c:380:16: note: in expansion of macro ‘PEEK_CHAR’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_tokener.c:380:16: note: in expansion of macro ‘PEEK_CHAR’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_tokener.c:1220:41: note: in expansion of macro ‘printbuf_memappend_checked’
# 1221|   					                           str - case_start);
# 1222|   					obj_field_name = strdup(tok->pb->buf);
# 1223|-> 					if (obj_field_name == NULL)
# 1224|   					{
# 1225|   						tok->err = json_tokener_error_memory;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
json-c-0.18-build/json-c-json-c-0.18-20240915/linkhash.h:350:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c: scope_hint: In function ‘json_object_deep_copy_recursive’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:15: included_from: Included from here.
json-c-0.18-build/json-c-json-c-0.18-20240915/strerror_override.h:12: included_from: Included from here.
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:13: included_from: Included from here.
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
json-c-0.18-build/json-c-json-c-0.18-20240915/json_object.c:1768:17: note: in expansion of macro ‘json_object_object_foreachC’
#  348|   static _LH_INLINE struct lh_entry *lh_table_head(const lh_table *t)
#  349|   {
#  350|-> 	return t->head;
#  351|   }
#  352|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def4]
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c: scope_hint: In function ‘test_printbuf_memappend’
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c:103:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘data’ where non-null expected
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c:12: included_from: Included from here.
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c:86:17: note: in expansion of macro ‘printbuf_memappend_fast’
<built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null
#  101|   	pb = printbuf_new();
#  102|   	char *data = malloc(*before_resize);
#  103|-> 	memset(data, 'X', *before_resize);
#  104|   	printbuf_memappend_fast(pb, data, *before_resize);
#  105|   	printf("Append to just before resize: %d, [%s]\n", printbuf_length(pb), pb->buf);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c:112:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘data’ where non-null expected
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c:86:17: note: in expansion of macro ‘printbuf_memappend_fast’
<built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null
#  110|   	pb = printbuf_new();
#  111|   	data = malloc(*before_resize + 1);
#  112|-> 	memset(data, 'X', *before_resize + 1);
#  113|   	printbuf_memappend_fast(pb, data, *before_resize + 1);
#  114|   	printf("Append to just after resize: %d, [%s]\n", printbuf_length(pb), pb->buf);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c: scope_hint: In function ‘test_sprintbuf’
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_printbuf.c:144:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘data’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null
#  142|   
#  143|   	char *data = malloc(before_resize + 1 + 1);
#  144|-> 	memset(data, 'X', before_resize + 1 + 1);
#  145|   	data[before_resize + 1] = '\0';
#  146|   	sprintbuf(pb, "%s", data);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def7]
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_util_file.c: scope_hint: In function ‘test_read_closed’
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_util_file.c:264:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 0), 10)’
#  262|   	// Copy over to a fixed fd number so test output is consistent.
#  263|   	int fixed_d = 10;
#  264|-> 	if (dup2(d, fixed_d) < 0)
#  265|   	{
#  266|   		printf("FAIL: unable to dup to fd %d", fixed_d);

Error: GCC_ANALYZER_WARNING: [#def8]
json-c-0.18-build/json-c-json-c-0.18-20240915/tests/test_util_file.c:264:13: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘open("/dev/null", 0)’
#  262|   	// Copy over to a fixed fd number so test output is consistent.
#  263|   	int fixed_d = 10;
#  264|-> 	if (dup2(d, fixed_d) < 0)
#  265|   	{
#  266|   		printf("FAIL: unable to dup to fd %d", fixed_d);

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-39.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namejson-c-0.18-1.fc42
store-results-to/tmp/tmpc1zngh1m/json-c-0.18-1.fc42.tar.xz
time-created2024-11-13 00:28:29
time-finished2024-11-13 00:29:56
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpc1zngh1m/json-c-0.18-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpc1zngh1m/json-c-0.18-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9