Task #22909 - json-c-0.18-1.fc42/scan-results.err

back to task #22909
download
Error: GCC_ANALYZER_WARNING (CWE-401):
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):
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):
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):
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):
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):
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):
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:
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);