libarchive-3.7.7-4.fc43

List of Findings

Error: CPPCHECK_WARNING (CWE-401): [#def1]
libarchive-3.7.7/libarchive/archive_match.c:236: error[memleak]: Memory leak: a
#  234|   	match_list_init(&(a->inclusion_gnames));
#  235|   	time(&a->now);
#  236|-> 	return (&(a->archive));
#  237|   }
#  238|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
libarchive-3.7.7/libarchive/archive_rb.c:374:44: warning[-Wanalyzer-null-dereference]: dereference of NULL 'standin'
libarchive-3.7.7/libarchive/archive_rb.c:492:1: enter_function: entry to '__archive_rb_tree_remove_node'
libarchive-3.7.7/libarchive/archive_rb.c:515:12: branch_false: following 'false' branch (when 'self' is non-NULL)...
libarchive-3.7.7/libarchive/archive_rb.c:515:13: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_rb.c:520:14: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_rb.c:544:19: call_function: calling '__archive_rb_tree_iterate' from '__archive_rb_tree_remove_node'
libarchive-3.7.7/libarchive/archive_rb.c:544:19: return_function: returning to '__archive_rb_tree_remove_node' from '__archive_rb_tree_iterate'
libarchive-3.7.7/libarchive/archive_rb.c:545:9: call_function: calling '__archive_rb_tree_swap_prune_and_rebalance' from '__archive_rb_tree_remove_node'
#  372|       struct archive_rb_node *self, struct archive_rb_node *standin)
#  373|   {
#  374|-> 	const unsigned int standin_which = RB_POSITION(standin);
#  375|   	unsigned int standin_other = standin_which ^ RB_DIR_OTHER;
#  376|   	struct archive_rb_node *standin_son;

Error: CPPCHECK_WARNING (CWE-401): [#def3]
libarchive-3.7.7/libarchive/archive_read_add_passphrase.c:83: error[memleak]: Memory leak: p.passphrase
#   81|   		return (NULL);
#   82|   	}
#   83|-> 	return (p);
#   84|   }
#   85|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1207:20: warning[-Wanalyzer-malloc-leak]: leak of '*t.sparse_list'
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1202:12: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1203:22: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1205:34: acquire_memory: allocated here
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1207:20: danger: '*t.sparse_list' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 1205|   		t->sparse_list = malloc(sizeof(t->sparse_list[0]) *
# 1206|   		    t->sparse_list_size);
# 1207|-> 		if (t->sparse_list == NULL) {
# 1208|   			t->sparse_list_size = 0;
# 1209|   			archive_set_error(&a->archive, ENOMEM,

Error: CPPCHECK_WARNING (CWE-476): [#def5]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2130: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2128|   	if (te == NULL)
# 2129|   		__archive_errx(1, "Out of memory");
# 2130|-> 	te->next = t->stack;
# 2131|   	te->parent = t->current;
# 2132|   	if (te->parent)

Error: CPPCHECK_WARNING (CWE-476): [#def6]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2131: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2129|   		__archive_errx(1, "Out of memory");
# 2130|   	te->next = t->stack;
# 2131|-> 	te->parent = t->current;
# 2132|   	if (te->parent)
# 2133|   		te->depth = te->parent->depth + 1;

Error: CPPCHECK_WARNING (CWE-476): [#def7]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2132: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2130|   	te->next = t->stack;
# 2131|   	te->parent = t->current;
# 2132|-> 	if (te->parent)
# 2133|   		te->depth = te->parent->depth + 1;
# 2134|   	t->stack = te;

Error: CPPCHECK_WARNING (CWE-476): [#def8]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2136: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2134|   	t->stack = te;
# 2135|   	archive_string_init(&te->name);
# 2136|-> 	te->symlink_parent_fd = -1;
# 2137|   	archive_strcpy(&te->name, path);
# 2138|   	te->flags = needsDescent | needsOpen | needsAscent;

Error: CPPCHECK_WARNING (CWE-476): [#def9]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2138: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2136|   	te->symlink_parent_fd = -1;
# 2137|   	archive_strcpy(&te->name, path);
# 2138|-> 	te->flags = needsDescent | needsOpen | needsAscent;
# 2139|   	te->filesystem_id = filesystem_id;
# 2140|   	te->dev = dev;

Error: CPPCHECK_WARNING (CWE-476): [#def10]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2139: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2137|   	archive_strcpy(&te->name, path);
# 2138|   	te->flags = needsDescent | needsOpen | needsAscent;
# 2139|-> 	te->filesystem_id = filesystem_id;
# 2140|   	te->dev = dev;
# 2141|   	te->ino = ino;

Error: CPPCHECK_WARNING (CWE-476): [#def11]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2140: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2138|   	te->flags = needsDescent | needsOpen | needsAscent;
# 2139|   	te->filesystem_id = filesystem_id;
# 2140|-> 	te->dev = dev;
# 2141|   	te->ino = ino;
# 2142|   	te->dirname_length = t->dirname_length;

Error: CPPCHECK_WARNING (CWE-476): [#def12]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2141: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2139|   	te->filesystem_id = filesystem_id;
# 2140|   	te->dev = dev;
# 2141|-> 	te->ino = ino;
# 2142|   	te->dirname_length = t->dirname_length;
# 2143|   	te->restore_time.name = te->name.s;

Error: CPPCHECK_WARNING (CWE-476): [#def13]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2142: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2140|   	te->dev = dev;
# 2141|   	te->ino = ino;
# 2142|-> 	te->dirname_length = t->dirname_length;
# 2143|   	te->restore_time.name = te->name.s;
# 2144|   	if (rt != NULL) {

Error: CPPCHECK_WARNING (CWE-476): [#def14]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2143: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2141|   	te->ino = ino;
# 2142|   	te->dirname_length = t->dirname_length;
# 2143|-> 	te->restore_time.name = te->name.s;
# 2144|   	if (rt != NULL) {
# 2145|   		te->restore_time.mtime = rt->mtime;

Error: CPPCHECK_WARNING (CWE-476): [#def15]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2145: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2143|   	te->restore_time.name = te->name.s;
# 2144|   	if (rt != NULL) {
# 2145|-> 		te->restore_time.mtime = rt->mtime;
# 2146|   		te->restore_time.mtime_nsec = rt->mtime_nsec;
# 2147|   		te->restore_time.atime = rt->atime;

Error: CPPCHECK_WARNING (CWE-476): [#def16]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2146: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2144|   	if (rt != NULL) {
# 2145|   		te->restore_time.mtime = rt->mtime;
# 2146|-> 		te->restore_time.mtime_nsec = rt->mtime_nsec;
# 2147|   		te->restore_time.atime = rt->atime;
# 2148|   		te->restore_time.atime_nsec = rt->atime_nsec;

Error: CPPCHECK_WARNING (CWE-476): [#def17]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2147: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2145|   		te->restore_time.mtime = rt->mtime;
# 2146|   		te->restore_time.mtime_nsec = rt->mtime_nsec;
# 2147|-> 		te->restore_time.atime = rt->atime;
# 2148|   		te->restore_time.atime_nsec = rt->atime_nsec;
# 2149|   		te->restore_time.filetype = rt->filetype;

Error: CPPCHECK_WARNING (CWE-476): [#def18]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2148: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2146|   		te->restore_time.mtime_nsec = rt->mtime_nsec;
# 2147|   		te->restore_time.atime = rt->atime;
# 2148|-> 		te->restore_time.atime_nsec = rt->atime_nsec;
# 2149|   		te->restore_time.filetype = rt->filetype;
# 2150|   		te->restore_time.noatime = rt->noatime;

Error: CPPCHECK_WARNING (CWE-476): [#def19]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2149: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2147|   		te->restore_time.atime = rt->atime;
# 2148|   		te->restore_time.atime_nsec = rt->atime_nsec;
# 2149|-> 		te->restore_time.filetype = rt->filetype;
# 2150|   		te->restore_time.noatime = rt->noatime;
# 2151|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def20]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2150: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2148|   		te->restore_time.atime_nsec = rt->atime_nsec;
# 2149|   		te->restore_time.filetype = rt->filetype;
# 2150|-> 		te->restore_time.noatime = rt->noatime;
# 2151|   	}
# 2152|   }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def21]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2237:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor '*t.initial_dir_fd'
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1318:1: enter_function: entry to 'archive_read_disk_open'
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1322:9: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1325:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1327:16: call_function: calling '_archive_read_disk_open' from 'archive_read_disk_open'
# 2235|   	 * unhelpful and unnecessary errors later.
# 2236|   	 */
# 2237|-> 	if (t->initial_dir_fd < 0)
# 2238|   		t->initial_dir_fd = open(".", o_flag | O_CLOEXEC);
# 2239|   #endif

Error: GCC_ANALYZER_WARNING (CWE-775): [#def22]
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:2238:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor '*t.initial_dir_fd'
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1318:1: enter_function: entry to 'archive_read_disk_open'
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1322:9: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1325:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_disk_posix.c:1327:16: call_function: calling '_archive_read_disk_open' from 'archive_read_disk_open'
# 2236|   	 */
# 2237|   	if (t->initial_dir_fd < 0)
# 2238|-> 		t->initial_dir_fd = open(".", o_flag | O_CLOEXEC);
# 2239|   #endif
# 2240|   	__archive_ensure_cloexec_flag(t->initial_dir_fd);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
libarchive-3.7.7/libarchive/archive_read_support_filter_gzip.c:200:25: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(p + (sizetype)len)'
libarchive-3.7.7/libarchive/archive_read_support_filter_gzip.c:341:1: enter_function: entry to 'consume_header'
libarchive-3.7.7/libarchive/archive_read_support_filter_gzip.c:351:15: call_function: calling 'peek_at_header' from 'consume_header'
#  198|   			/* Reset the name in case of repeat header reads. */
#  199|   			free(state->name);
#  200|-> 			state->name = strdup((const char *)&p[file_start]);
#  201|   		}
#  202|   #endif

Error: GCC_ANALYZER_WARNING (CWE-401): [#def24]
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:260:12: warning[-Wanalyzer-malloc-leak]: leak of 'out_block'
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:372:1: enter_function: entry to 'lz4_filter_read_descriptor'
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:384:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:394:31: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:396:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:399:12: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:399:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:401:43: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:410:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:413:17: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:451:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:455:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:458:13: call_function: calling 'lz4_allocate_out_block' from 'lz4_filter_read_descriptor'
#  258|   		state->out_block = out_block;
#  259|   	}
#  260|-> 	if (!state->flags.block_independence)
#  261|   		memset(state->out_block, 0, 64 * 1024);
#  262|   	return (ARCHIVE_OK);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def25]
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:261:17: warning[-Wanalyzer-malloc-leak]: leak of 'out_block'
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:372:1: enter_function: entry to 'lz4_filter_read_descriptor'
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:384:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:394:31: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:396:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:399:12: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:399:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:401:43: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:410:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:413:17: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:451:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:455:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_lz4.c:458:13: call_function: calling 'lz4_allocate_out_block' from 'lz4_filter_read_descriptor'
#  259|   	}
#  260|   	if (!state->flags.block_independence)
#  261|-> 		memset(state->out_block, 0, 64 * 1024);
#  262|   	return (ARCHIVE_OK);
#  263|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:438:17: warning[-Wanalyzer-malloc-leak]: leak of 'ptr'
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:460:1: enter_function: entry to 'uudecode_filter_read'
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:484:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:488:13: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:488:12: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:489:20: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:489:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:500:21: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_read_support_filter_uu.c:499:21: call_function: calling 'ensure_in_buff_size' from 'uudecode_filter_read'
#  436|   		free(uudecode->in_buff);
#  437|   		uudecode->in_buff = ptr;
#  438|-> 		uudecode->in_allocated = newsize;
#  439|   	}
#  440|   	return (ARCHIVE_OK);

Error: GCC_ANALYZER_WARNING (CWE-465): [#def27]
libarchive-3.7.7/libarchive/archive_string.c:205:12: warning[-Wanalyzer-deref-before-check]: check of 'as' for NULL after already dereferencing it
libarchive-3.7.7/libarchive/archive_string.c:2230:1: enter_function: entry to 'best_effort_strncat_in_locale'
libarchive-3.7.7/libarchive/archive_string.c:2256:16: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_string.c:2257:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_string.c:2259:29: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_string.c:2259:28: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_string.c:2260:37: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_string.c:2260:37: call_function: calling 'archive_string_append' from 'best_effort_strncat_in_locale'
#  203|   archive_string_append(struct archive_string *as, const char *p, size_t s)
#  204|   {
#  205|-> 	if (archive_string_ensure(as, as->length + s + 1) == NULL)
#  206|   		return (NULL);
#  207|   	if (s)

Error: GCC_ANALYZER_WARNING (CWE-415): [#def28]
libarchive-3.7.7/libarchive/archive_util.c:654:31: warning[-Wanalyzer-double-free]: double-'free' of 'lesser'
libarchive-3.7.7/libarchive/archive_util.c:643:12: branch_false: following 'false' branch (when 'n > 1')...
libarchive-3.7.7/libarchive/archive_util.c:648:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_util.c:665:25: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:667:28: branch_false: following 'false' branch (when 'tmp' is non-NULL)...
libarchive-3.7.7/libarchive/archive_util.c:673:33: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_util.c:653:25: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:654:31: danger: second 'free' here
#  652|   		{
#  653|   			lesser_count++;
#  654|-> 			tmp = realloc(lesser, lesser_count * sizeof(*tmp));
#  655|   			if (!tmp) {
#  656|   				free(greater);

Error: GCC_ANALYZER_WARNING (CWE-415): [#def29]
libarchive-3.7.7/libarchive/archive_util.c:656:33: warning[-Wanalyzer-double-free]: double-'free' of 'greater'
libarchive-3.7.7/libarchive/archive_util.c:643:12: branch_false: following 'false' branch (when 'n > 1')...
libarchive-3.7.7/libarchive/archive_util.c:648:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_util.c:653:25: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:655:28: branch_false: following 'false' branch (when 'tmp' is non-NULL)...
libarchive-3.7.7/libarchive/archive_util.c:661:32: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_util.c:653:25: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:655:28: branch_true: following 'true' branch (when 'tmp' is NULL)...
libarchive-3.7.7/libarchive/archive_util.c:656:33: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:656:33: danger: second 'free' here
#  654|   			tmp = realloc(lesser, lesser_count * sizeof(*tmp));
#  655|   			if (!tmp) {
#  656|-> 				free(greater);
#  657|   				free(lesser);
#  658|   				return (ARCHIVE_FATAL);

Error: GCC_ANALYZER_WARNING (CWE-415): [#def30]
libarchive-3.7.7/libarchive/archive_util.c:666:31: warning[-Wanalyzer-double-free]: double-'free' of 'greater'
libarchive-3.7.7/libarchive/archive_util.c:643:12: branch_false: following 'false' branch (when 'n > 1')...
libarchive-3.7.7/libarchive/archive_util.c:648:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_util.c:653:25: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:655:28: branch_false: following 'false' branch (when 'tmp' is non-NULL)...
libarchive-3.7.7/libarchive/archive_util.c:661:32: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_util.c:665:25: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:666:31: danger: second 'free' here
#  664|   		{
#  665|   			greater_count++;
#  666|-> 			tmp = realloc(greater, greater_count * sizeof(*tmp));
#  667|   			if (!tmp) {
#  668|   				free(greater);

Error: GCC_ANALYZER_WARNING (CWE-415): [#def31]
libarchive-3.7.7/libarchive/archive_util.c:669:33: warning[-Wanalyzer-double-free]: double-'free' of 'lesser'
libarchive-3.7.7/libarchive/archive_util.c:643:12: branch_false: following 'false' branch (when 'n > 1')...
libarchive-3.7.7/libarchive/archive_util.c:648:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_util.c:665:25: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:667:28: branch_false: following 'false' branch (when 'tmp' is non-NULL)...
libarchive-3.7.7/libarchive/archive_util.c:673:33: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_util.c:665:25: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:667:28: branch_true: following 'true' branch (when 'tmp' is NULL)...
libarchive-3.7.7/libarchive/archive_util.c:668:33: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:669:33: danger: second 'free' here
#  667|   			if (!tmp) {
#  668|   				free(greater);
#  669|-> 				free(lesser);
#  670|   				return (ARCHIVE_FATAL);
#  671|   			}

Error: GCC_ANALYZER_WARNING (CWE-415): [#def32]
libarchive-3.7.7/libarchive/archive_util.c:681:9: warning[-Wanalyzer-double-free]: double-'free' of 'lesser'
libarchive-3.7.7/libarchive/archive_util.c:636:1: enter_function: entry to 'archive_utility_string_sort_helper'
libarchive-3.7.7/libarchive/archive_util.c:643:12: branch_false: following 'false' branch (when 'n > 1')...
libarchive-3.7.7/libarchive/archive_util.c:648:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_util.c:665:25: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:667:28: branch_false: following 'false' branch (when 'tmp' is non-NULL)...
libarchive-3.7.7/libarchive/archive_util.c:673:33: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_false: following 'false' branch (when 'i >= n')...
libarchive-3.7.7/libarchive/archive_util.c:678:19: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:678:19: call_function: passing freed pointer 'lesser' in call to 'archive_utility_string_sort_helper' from 'archive_utility_string_sort_helper'
libarchive-3.7.7/libarchive/archive_util.c:678:19: return_function: returning to 'archive_utility_string_sort_helper' from 'archive_utility_string_sort_helper'
libarchive-3.7.7/libarchive/archive_util.c:679:21: branch_false: following 'false' branch (when 'i >= lesser_count')...
libarchive-3.7.7/libarchive/archive_util.c:681:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:681:9: danger: second 'free' here
#  679|   	for (i = 0; i < lesser_count; i++)
#  680|   		strings[i] = lesser[i];
#  681|-> 	free(lesser);
#  682|   
#  683|   	/* pivot */

Error: GCC_ANALYZER_WARNING (CWE-415): [#def33]
libarchive-3.7.7/libarchive/archive_util.c:690:9: warning[-Wanalyzer-double-free]: double-'free' of 'greater'
libarchive-3.7.7/libarchive/archive_util.c:636:1: enter_function: entry to 'archive_utility_string_sort_helper'
libarchive-3.7.7/libarchive/archive_util.c:643:12: branch_false: following 'false' branch (when 'n > 1')...
libarchive-3.7.7/libarchive/archive_util.c:648:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_util.c:653:25: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:655:28: branch_false: following 'false' branch (when 'tmp' is non-NULL)...
libarchive-3.7.7/libarchive/archive_util.c:661:32: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_true: following 'true' branch (when 'i < n')...
libarchive-3.7.7/libarchive/archive_util.c:651:35: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:651:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_util.c:653:25: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_util.c:655:28: branch_false: following 'false' branch (when 'tmp' is non-NULL)...
libarchive-3.7.7/libarchive/archive_util.c:661:32: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:649:21: branch_false: following 'false' branch (when 'i >= n')...
libarchive-3.7.7/libarchive/archive_util.c:678:19: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_util.c:678:19: call_function: calling 'archive_utility_string_sort_helper' from 'archive_utility_string_sort_helper'
#  688|   	for (i = 0; i < greater_count; i++)
#  689|   		strings[lesser_count + 1 + i] = greater[i];
#  690|-> 	free(greater);
#  691|   
#  692|   	return (retval1 < retval2) ? retval1 : retval2;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def34]
libarchive-3.7.7/libarchive/archive_write.c:123:16: warning[-Wanalyzer-malloc-leak]: leak of 'a'
libarchive-3.7.7/libarchive/archive_write.c:101:13: acquire_memory: allocated here
libarchive-3.7.7/libarchive/archive_write.c:102:12: branch_false: following 'false' branch (when 'a' is non-NULL)...
libarchive-3.7.7/libarchive/archive_write.c:104:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write.c:118:12: branch_false: following 'false' branch (when 'nulls' is non-NULL)...
libarchive-3.7.7/libarchive/archive_write.c:122:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write.c:123:16: danger: 'a' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  121|   	}
#  122|   	a->nulls = nulls;
#  123|-> 	return (&a->archive);
#  124|   }
#  125|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def35]
libarchive-3.7.7/libarchive/archive_write_add_filter_bzip2.c:181:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.7.7/libarchive/archive_write_add_filter_bzip2.c:168:12: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_write_add_filter_bzip2.c:170:21: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_write_add_filter_bzip2.c:180:36: acquire_memory: allocated here
libarchive-3.7.7/libarchive/archive_write_add_filter_bzip2.c:181:20: danger: 'malloc(bs)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  179|   		data->compressed_buffer_size = bs;
#  180|   		data->compressed = malloc(data->compressed_buffer_size);
#  181|-> 		if (data->compressed == NULL) {
#  182|   			archive_set_error(f->archive, ENOMEM,
#  183|   			    "Can't allocate data for compression buffer");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def36]
libarchive-3.7.7/libarchive/archive_write_add_filter_gzip.c:198:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.7.7/libarchive/archive_write_add_filter_gzip.c:185:12: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_write_add_filter_gzip.c:187:21: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_write_add_filter_gzip.c:197:36: acquire_memory: allocated here
libarchive-3.7.7/libarchive/archive_write_add_filter_gzip.c:198:20: danger: 'malloc(bs)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  196|   		data->compressed_buffer_size = bs;
#  197|   		data->compressed = malloc(data->compressed_buffer_size);
#  198|-> 		if (data->compressed == NULL) {
#  199|   			archive_set_error(f->archive, ENOMEM,
#  200|   			    "Can't allocate data for compression buffer");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def37]
libarchive-3.7.7/libarchive/archive_write_add_filter_xz.c:323:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.7.7/libarchive/archive_write_add_filter_xz.c:310:12: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_write_add_filter_xz.c:312:21: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_write_add_filter_xz.c:322:36: acquire_memory: allocated here
libarchive-3.7.7/libarchive/archive_write_add_filter_xz.c:323:20: danger: 'malloc(bs)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  321|   		data->compressed_buffer_size = bs;
#  322|   		data->compressed = malloc(data->compressed_buffer_size);
#  323|-> 		if (data->compressed == NULL) {
#  324|   			archive_set_error(f->archive, ENOMEM,
#  325|   			    "Can't allocate data for compression buffer");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def38]
libarchive-3.7.7/libarchive/archive_write_add_filter_zstd.c:376:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.7.7/libarchive/archive_write_add_filter_zstd.c:362:12: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_write_add_filter_zstd.c:363:29: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_write_add_filter_zstd.c:375:33: acquire_memory: allocated here
libarchive-3.7.7/libarchive/archive_write_add_filter_zstd.c:376:20: danger: 'malloc(bs)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  374|   		data->out.pos = 0;
#  375|   		data->out.dst = malloc(data->out.size);
#  376|-> 		if (data->out.dst == NULL) {
#  377|   			archive_set_error(f->archive, ENOMEM,
#  378|   			    "Can't allocate data for compression buffer");

Error: CPPCHECK_WARNING (CWE-401): [#def39]
libarchive-3.7.7/libarchive/archive_write_open_filename.c:113: error[memleak]: Memory leak: mine
#  111|   		if (errno == ENOMEM) {
#  112|   			archive_set_error(a, ENOMEM, "No memory");
#  113|-> 			return (ARCHIVE_FATAL);
#  114|   		}
#  115|   		if (mbs_fn)

Error: CPPCHECK_WARNING (CWE-401): [#def40]
libarchive-3.7.7/libarchive/archive_write_open_filename.c:123: error[memleak]: Memory leak: mine
#  121|   			    "Can't convert '%S' to MBS",
#  122|   			    (const wchar_t *)filename);
#  123|-> 		return (ARCHIVE_FAILED);
#  124|   	}
#  125|   	mine->fd = -1;

Error: GCC_ANALYZER_WARNING (CWE-835): [#def41]
libarchive-3.7.7/libarchive/archive_write_set_format_7zip.c:592:21: warning[-Wanalyzer-infinite-loop]: infinite loop
libarchive-3.7.7/libarchive/archive_write_set_format_7zip.c:1271:1: enter_function: entry to 'make_header'
#  590|   	for (;;) {
#  591|   		/* Compress file data. */
#  592|-> 		r = compression_code(&(a->archive), &(zip->stream), run);
#  593|   		if (r != ARCHIVE_OK && r != ARCHIVE_EOF)
#  594|   			return (ARCHIVE_FATAL);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def42]
libarchive-3.7.7/libarchive/archive_write_set_format_cpio_binary.c:324:9: warning[-Wanalyzer-malloc-leak]: leak of 'newlist'
libarchive-3.7.7/libarchive/archive_write_set_format_cpio_binary.c:379:1: enter_function: entry to 'write_header'
libarchive-3.7.7/libarchive/archive_write_set_format_cpio_binary.c:431:15: call_function: calling 'synthesize_ino_value' from 'write_header'
#  322|   	cpio->ino_list[cpio->ino_list_next].old = ino;
#  323|   	cpio->ino_list[cpio->ino_list_next].new = ino_new;
#  324|-> 	++cpio->ino_list_next;
#  325|   	return (ino_new);
#  326|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def43]
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:6791:17: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:6984:1: enter_function: entry to 'isoent_make_path_table'
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:6995:21: call_function: calling 'isoent_alloc_path_table' from 'isoent_make_path_table'
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:6995:21: return_function: returning to 'isoent_make_path_table' from 'isoent_alloc_path_table'
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7002:12: branch_false: following 'false' branch (when 'r == 0')...
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7004:13: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7004:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7014:9: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7014:9: call_function: calling 'isoent_collect_dirs' from 'isoent_make_path_table'
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7014:9: return_function: returning to 'isoent_make_path_table' from 'isoent_collect_dirs'
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7020:12: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7021:21: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_iso9660.c:7021:21: call_function: calling 'isoent_rr_move' from 'isoent_make_path_table'
# 6789|   		 * its sub directory entries move to rr_move too.
# 6790|   		 */
# 6791|-> 		np = last->ptnext;
# 6792|   	}
# 6793|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2151:23: warning[-Wanalyzer-null-dereference]: dereference of NULL 'dent'
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:1986:1: enter_function: entry to 'mtree_entry_tree_add'
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2013:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2021:14: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2047:21: call_function: calling 'get_path_component' from 'mtree_entry_tree_add'
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2047:21: return_function: returning to 'mtree_entry_tree_add' from 'get_path_component'
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2048:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2052:20: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2052:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2058:20: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2084:12: branch_true: following 'true' branch (when 'np' is NULL)...
 branch_true: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2088:24: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2131:17: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2131:17: release_memory: 'dent' is NULL
libarchive-3.7.7/libarchive/archive_write_set_format_mtree.c:2151:23: danger: dereference of NULL 'dent'
# 2149|   
# 2150|   		if (!__archive_rb_tree_insert_node(
# 2151|-> 		    &(dent->dir_info->rbtree),
# 2152|   		    (struct archive_rb_node *)file)) {
# 2153|   			np = (struct mtree_entry *)__archive_rb_tree_find_node(

Error: GCC_ANALYZER_WARNING (CWE-457): [#def45]
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1291:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '&zip64'
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1142:1: enter_function: entry to 'archive_write_zip_finish_entry'
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1269:20: branch_true: following 'true' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1270:41: branch_true: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1274:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1279:21: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1279:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1284:54: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1285:22: call_function: calling 'cd_alloc' from 'archive_write_zip_finish_entry'
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1285:22: return_function: returning to 'archive_write_zip_finish_entry' from 'cd_alloc'
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1286:20: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1291:17: branch_false: ...to here
libarchive-3.7.7/libarchive/archive_write_set_format_zip.c:1291:17: danger: use of uninitialized value '&zip64' here
# 1289|   			return (ARCHIVE_FATAL);
# 1290|   		}
# 1291|-> 		memcpy(zd, zip64, z - zip64);
# 1292|   		/* Zip64 means version needs to be set to at least 4.5 */
# 1293|   		if (archive_le16dec(zip->file_header + 6) < 45)

Error: CPPCHECK_WARNING (CWE-476): [#def46]
libarchive-3.7.7/libarchive/xxhash.c:350: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
#  348|   {
#  349|       struct XXH_state32_t * state = (struct XXH_state32_t *) state_in;
#  350|->     state->seed = seed;
#  351|       state->v1 = seed + PRIME32_1 + PRIME32_2;
#  352|       state->v2 = seed + PRIME32_2;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def47]
libarchive-3.7.7/libarchive/xxhash.c:350:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'state'
libarchive-3.7.7/libarchive/xxhash.c:363:19: acquire_memory: this call could return NULL
libarchive-3.7.7/libarchive/xxhash.c:364:5: call_function: inlined call to 'XXH32_resetState' from 'XXH32_init'
#  348|   {
#  349|       struct XXH_state32_t * state = (struct XXH_state32_t *) state_in;
#  350|->     state->seed = seed;
#  351|       state->v1 = seed + PRIME32_1 + PRIME32_2;
#  352|       state->v2 = seed + PRIME32_2;

Error: CPPCHECK_WARNING (CWE-476): [#def48]
libarchive-3.7.7/libarchive/xxhash.c:351: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
#  349|       struct XXH_state32_t * state = (struct XXH_state32_t *) state_in;
#  350|       state->seed = seed;
#  351|->     state->v1 = seed + PRIME32_1 + PRIME32_2;
#  352|       state->v2 = seed + PRIME32_2;
#  353|       state->v3 = seed + 0;

Error: CPPCHECK_WARNING (CWE-476): [#def49]
libarchive-3.7.7/libarchive/xxhash.c:352: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
#  350|       state->seed = seed;
#  351|       state->v1 = seed + PRIME32_1 + PRIME32_2;
#  352|->     state->v2 = seed + PRIME32_2;
#  353|       state->v3 = seed + 0;
#  354|       state->v4 = seed - PRIME32_1;

Error: CPPCHECK_WARNING (CWE-476): [#def50]
libarchive-3.7.7/libarchive/xxhash.c:353: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
#  351|       state->v1 = seed + PRIME32_1 + PRIME32_2;
#  352|       state->v2 = seed + PRIME32_2;
#  353|->     state->v3 = seed + 0;
#  354|       state->v4 = seed - PRIME32_1;
#  355|       state->total_len = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def51]
libarchive-3.7.7/libarchive/xxhash.c:354: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
#  352|       state->v2 = seed + PRIME32_2;
#  353|       state->v3 = seed + 0;
#  354|->     state->v4 = seed - PRIME32_1;
#  355|       state->total_len = 0;
#  356|       state->memsize = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def52]
libarchive-3.7.7/libarchive/xxhash.c:355: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
#  353|       state->v3 = seed + 0;
#  354|       state->v4 = seed - PRIME32_1;
#  355|->     state->total_len = 0;
#  356|       state->memsize = 0;
#  357|       return XXH_OK;

Error: CPPCHECK_WARNING (CWE-476): [#def53]
libarchive-3.7.7/libarchive/xxhash.c:356: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
#  354|       state->v4 = seed - PRIME32_1;
#  355|       state->total_len = 0;
#  356|->     state->memsize = 0;
#  357|       return XXH_OK;
#  358|   }

Error: CPPCHECK_WARNING (CWE-476): [#def54]
libarchive-3.7.7/libarchive_fe/line_reader.c:65: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lr
#   63|   		lafe_errc(1, ENOMEM, "Can't open %s", pathname);
#   64|   
#   65|-> 	lr->nullSeparator = nullSeparator;
#   66|   	lr->pathname = strdup(pathname);
#   67|   

Error: CPPCHECK_WARNING (CWE-476): [#def55]
libarchive-3.7.7/libarchive_fe/line_reader.c:66: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lr
#   64|   
#   65|   	lr->nullSeparator = nullSeparator;
#   66|-> 	lr->pathname = strdup(pathname);
#   67|   
#   68|   	if (strcmp(pathname, "-") == 0)

Error: CPPCHECK_WARNING (CWE-476): [#def56]
libarchive-3.7.7/libarchive_fe/line_reader.c:72: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lr
#   70|   	else
#   71|   		lr->f = fopen(pathname, "r");
#   72|-> 	if (lr->f == NULL)
#   73|   		lafe_errc(1, errno, "Couldn't open %s", pathname);
#   74|   	lr->buff_length = 8192;

Error: CPPCHECK_WARNING (CWE-476): [#def57]
libarchive-3.7.7/libarchive_fe/line_reader.c:74: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lr
#   72|   	if (lr->f == NULL)
#   73|   		lafe_errc(1, errno, "Couldn't open %s", pathname);
#   74|-> 	lr->buff_length = 8192;
#   75|   	lr->line_start = lr->line_end = lr->buff_end = lr->buff = NULL;
#   76|   

Error: CPPCHECK_WARNING (CWE-476): [#def58]
libarchive-3.7.7/libarchive_fe/line_reader.c:75: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lr
#   73|   		lafe_errc(1, errno, "Couldn't open %s", pathname);
#   74|   	lr->buff_length = 8192;
#   75|-> 	lr->line_start = lr->line_end = lr->buff_end = lr->buff = NULL;
#   76|   
#   77|   	return (lr);

Error: CPPCHECK_WARNING (CWE-401): [#def59]
libarchive-3.7.7/libarchive_fe/line_reader.c:77: error[memleak]: Memory leak: lr.pathname
#   75|   	lr->line_start = lr->line_end = lr->buff_end = lr->buff = NULL;
#   76|   
#   77|-> 	return (lr);
#   78|   }
#   79|   

Error: CPPCHECK_WARNING (CWE-404): [#def60]
libarchive-3.7.7/libarchive_fe/line_reader.c:77: error[resourceLeak]: Resource leak: lr.f
#   75|   	lr->line_start = lr->line_end = lr->buff_end = lr->buff = NULL;
#   76|   
#   77|-> 	return (lr);
#   78|   }
#   79|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def61]
libarchive-3.7.7/libarchive_fe/passphrase.c:208:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/dev/tty", 2)'
libarchive-3.7.7/libarchive_fe/passphrase.c:178:12: branch_false: following 'false' branch (when 'bufsiz != 0')...
 branch_false: ...to here
libarchive-3.7.7/libarchive_fe/passphrase.c:184:21: branch_true: following 'true' branch (when 'i != 23')...
libarchive-3.7.7/libarchive_fe/passphrase.c:185:17: branch_true: ...to here
libarchive-3.7.7/libarchive_fe/passphrase.c:193:12: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive_fe/passphrase.c:194:31: branch_false: ...to here
libarchive-3.7.7/libarchive_fe/passphrase.c:194:31: acquire_resource: opened here
libarchive-3.7.7/libarchive_fe/passphrase.c:193:13: branch_false: following 'false' branch...
libarchive-3.7.7/libarchive_fe/passphrase.c:208:12: branch_false: ...to here
libarchive-3.7.7/libarchive_fe/passphrase.c:208:12: danger: 'open("/dev/tty", 2)' leaks here; was opened at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  206|   	 * generate SIGTTOU, so do it *before* installing the signal handlers.
#  207|   	 */
#  208|-> 	if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) {
#  209|   		memcpy(&term, &oterm, sizeof(term));
#  210|   		if (!(flags & RPP_ECHO_ON))

Error: CPPCHECK_WARNING (CWE-476): [#def62]
libarchive-3.7.7/tar/creation_set.c:248: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: name
#  246|   	for (;;) {
#  247|   		/* Get the suffix. */
#  248|-> 		p = strrchr(name, '.');
#  249|   		if (p == NULL)
#  250|   			break;

Error: CPPCHECK_WARNING (CWE-476): [#def63]
libarchive-3.7.7/tar/creation_set.c:289: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: v
#  287|   		/* Reverse filter sequence. */
#  288|   		for (i = 0, r = cset->filter_count; r > 0; )
#  289|-> 			v[i++] = cset->filters[--r];
#  290|   		free(cset->filters);
#  291|   		cset->filters = v;

Error: CPPCHECK_WARNING (CWE-476): [#def64]
libarchive-3.7.7/tar/subst.c:69: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rule
#   67|   	if (rule == NULL)
#   68|   		lafe_errc(1, errno, "Out of memory");
#   69|-> 	rule->next = NULL;
#   70|   	rule->result = NULL;
#   71|   

Error: CPPCHECK_WARNING (CWE-476): [#def65]
libarchive-3.7.7/tar/subst.c:70: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rule
#   68|   		lafe_errc(1, errno, "Out of memory");
#   69|   	rule->next = NULL;
#   70|-> 	rule->result = NULL;
#   71|   
#   72|   	if (subst->last_rule == NULL)

Error: CPPCHECK_WARNING (CWE-476): [#def66]
libarchive-3.7.7/tar/subst.c:87: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pattern
#   85|   	if (pattern == NULL)
#   86|   		lafe_errc(1, errno, "Out of memory");
#   87|-> 	memcpy(pattern, rule_text + 1, end_pattern - rule_text - 1);
#   88|   	pattern[end_pattern - rule_text - 1] = '\0';
#   89|   

Error: CPPCHECK_WARNING (CWE-476): [#def67]
libarchive-3.7.7/tar/subst.c:88: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pattern
#   86|   		lafe_errc(1, errno, "Out of memory");
#   87|   	memcpy(pattern, rule_text + 1, end_pattern - rule_text - 1);
#   88|-> 	pattern[end_pattern - rule_text - 1] = '\0';
#   89|   
#   90|   	if ((r = regcomp(&rule->re, pattern, REG_BASIC)) != 0) {

Error: CPPCHECK_WARNING (CWE-562): [#def68]
libarchive-3.7.7/tar/write.c:342: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  340|   	struct archive_dir	 archive_dir;
#  341|   
#  342|-> 	bsdtar->archive_dir = &archive_dir;
#  343|   	memset(&archive_dir, 0, sizeof(archive_dir));
#  344|   

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-103.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namelibarchive-3.7.7-4.fc43
store-results-to/tmp/tmpbywfilfr/libarchive-3.7.7-4.fc43.tar.xz
time-created2025-04-25 13:52:47
time-finished2025-04-25 13:54:59
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpbywfilfr/libarchive-3.7.7-4.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpbywfilfr/libarchive-3.7.7-4.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9