Task #132021 - libarchive-3.8.4-2.fc44/scan-results.err
back to task #132021download
Error: GCC_ANALYZER_WARNING (CWE-688):
libarchive-3.8.4/cpio/cpio.c:1241:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*cpio.destdir’ where non-null expected
libarchive-3.8.4/cpio/cpio.c:1240:25: acquire_memory: this call could return NULL
libarchive-3.8.4/cpio/cpio.c:1241:9: danger: argument 1 (‘malloc(strlen(destdir) + 8)’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 1239| cpio->destdir_len = strlen(destdir);
# 1240| cpio->destdir = malloc(cpio->destdir_len + 8);
# 1241|-> memcpy(cpio->destdir, destdir, cpio->destdir_len);
# 1242| if (cpio->destdir_len == 0 || destdir[cpio->destdir_len - 1] != '/')
# 1243| cpio->destdir[cpio->destdir_len++] = '/';
Error: CPPCHECK_WARNING (CWE-401):
libarchive-3.8.4/libarchive/archive_match.c:240: error[memleak]: Memory leak: a
# 238| match_list_init(&(a->inclusion_gnames));
# 239| time(&a->now);
# 240|-> return (&(a->archive));
# 241| }
# 242|
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_options.c: scope_hint: In function 'parse_option'
libarchive-3.8.4/libarchive/archive_options.c:179:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 179 | p = strchr(opt, ',');
# | ^
# 177| val = "1";
# 178|
# 179|-> p = strchr(opt, ',');
# 180|
# 181| if (p != NULL) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_options.c:179:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 177| val = "1";
# 178|
# 179|-> p = strchr(opt, ',');
# 180|
# 181| if (p != NULL) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_options.c:194:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 194 | p = strchr(opt, ':');
# | ^
# 192| }
# 193|
# 194|-> p = strchr(opt, ':');
# 195| if (p != NULL) {
# 196| *p = '\0';
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_options.c:194:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 192| }
# 193|
# 194|-> p = strchr(opt, ':');
# 195| if (p != NULL) {
# 196| *p = '\0';
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_options.c:201:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 201 | p = strchr(opt, '=');
# | ^
# 199| }
# 200|
# 201|-> p = strchr(opt, '=');
# 202| if (p != NULL) {
# 203| *p = '\0';
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_options.c:201:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 199| }
# 200|
# 201|-> p = strchr(opt, '=');
# 202| if (p != NULL) {
# 203| *p = '\0';
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_pack_dev.c: scope_hint: In function 'pack_find'
libarchive-3.8.4/libarchive/archive_pack_dev.c:324:16: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 324 | format = bsearch(name, formats,
# | ^
# 322| struct format *format;
# 323|
# 324|-> format = bsearch(name, formats,
# 325| sizeof(formats)/sizeof(formats[0]),
# 326| sizeof(formats[0]), compare_format);
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_pack_dev.c:324:16: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 322| struct format *format;
# 323|
# 324|-> format = bsearch(name, formats,
# 325| sizeof(formats)/sizeof(formats[0]),
# 326| sizeof(formats[0]), compare_format);
Error: GCC_ANALYZER_WARNING (CWE-476):
libarchive-3.8.4/libarchive/archive_rb.c:374:44: warning[-Wanalyzer-null-dereference]: dereference of NULL 'standin'
libarchive-3.8.4/libarchive/archive_rb.c:492:1: enter_function: entry to '__archive_rb_tree_remove_node'
libarchive-3.8.4/libarchive/archive_rb.c:515:12: branch_false: following 'false' branch (when 'self' is non-NULL)...
libarchive-3.8.4/libarchive/archive_rb.c:515:13: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_rb.c:520:14: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_rb.c:544:19: call_function: calling '__archive_rb_tree_iterate' from '__archive_rb_tree_remove_node'
libarchive-3.8.4/libarchive/archive_rb.c:544:19: return_function: returning to '__archive_rb_tree_remove_node' from '__archive_rb_tree_iterate'
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1203:20: warning[-Wanalyzer-malloc-leak]: leak of '*t.sparse_list'
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1198:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1199:22: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1201:34: acquire_memory: allocated here
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1203:20: danger: '*t.sparse_list' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 1201| t->sparse_list = malloc(sizeof(t->sparse_list[0]) *
# 1202| t->sparse_list_size);
# 1203|-> if (t->sparse_list == NULL) {
# 1204| t->sparse_list_size = 0;
# 1205| archive_set_error(&a->archive, ENOMEM,
Error: CPPCHECK_WARNING (CWE-476):
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:2037: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2035| if (te == NULL)
# 2036| __archive_errx(1, "Out of memory");
# 2037|-> te->next = t->stack;
# 2038| te->parent = t->current;
# 2039| if (te->parent)
Error: CPPCHECK_WARNING (CWE-476):
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:2038: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2036| __archive_errx(1, "Out of memory");
# 2037| te->next = t->stack;
# 2038|-> te->parent = t->current;
# 2039| if (te->parent)
# 2040| te->depth = te->parent->depth + 1;
Error: CPPCHECK_WARNING (CWE-476):
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:2039: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: te
# 2037| te->next = t->stack;
# 2038| te->parent = t->current;
# 2039|-> if (te->parent)
# 2040| te->depth = te->parent->depth + 1;
# 2041| t->stack = te;
Error: GCC_ANALYZER_WARNING (CWE-775):
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:2144:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor '*t.initial_dir_fd'
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1314:1: enter_function: entry to 'archive_read_disk_open'
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1318:9: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1321:9: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1323:16: call_function: calling '_archive_read_disk_open' from 'archive_read_disk_open'
# 2142| * unhelpful and unnecessary errors later.
# 2143| */
# 2144|-> if (t->initial_dir_fd < 0)
# 2145| t->initial_dir_fd = open(".", o_flag | O_CLOEXEC);
# 2146| #endif
Error: GCC_ANALYZER_WARNING (CWE-775):
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:2145:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor '*t.initial_dir_fd'
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1314:1: enter_function: entry to 'archive_read_disk_open'
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1318:9: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1321:9: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_disk_posix.c:1323:16: call_function: calling '_archive_read_disk_open' from 'archive_read_disk_open'
# 2143| */
# 2144| if (t->initial_dir_fd < 0)
# 2145|-> t->initial_dir_fd = open(".", o_flag | O_CLOEXEC);
# 2146| #endif
# 2147| __archive_ensure_cloexec_flag(t->initial_dir_fd);
Error: GCC_ANALYZER_WARNING (CWE-401):
libarchive-3.8.4/libarchive/archive_read_support_filter_gzip.c:200:25: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(p + (sizetype)len)'
libarchive-3.8.4/libarchive/archive_read_support_filter_gzip.c:341:1: enter_function: entry to 'consume_header'
libarchive-3.8.4/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):
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:319:1: warning[-Wanalyzer-malloc-leak]: leak of 'out_block'
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:427:1: enter_function: entry to 'lz4_filter_read_descriptor'
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:439:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:449:31: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:451:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:451:12: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:454:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:454:12: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:465:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:468:17: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:506:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:510:9: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_lz4.c:513:13: call_function: calling 'lz4_allocate_out_block' from 'lz4_filter_read_descriptor'
# 317| memset(state->out_block, 0, 64 * 1024);
# 318| return (ARCHIVE_OK);
# 319|-> }
# 320|
# 321| static int
Error: GCC_ANALYZER_WARNING (CWE-688):
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:152:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc(signature_len)' where non-null expected
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:143:12: branch_false: following 'false' branch (when 'state' is non-NULL)...
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:145:22: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:146:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:149:13: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:149:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:150:17: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:151:36: acquire_memory: this call could return NULL
libarchive-3.8.4/libarchive/archive_read_support_filter_program.c:152:17: danger: argument 1 ('malloc(signature_len)') from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
# 150| state->signature_len = signature_len;
# 151| state->signature = malloc(signature_len);
# 152|-> memcpy(state->signature, signature, signature_len);
# 153| }
# 154|
Error: GCC_ANALYZER_WARNING (CWE-401):
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:441:1: warning[-Wanalyzer-malloc-leak]: leak of 'ptr'
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:460:1: enter_function: entry to 'uudecode_filter_read'
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:474:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:482:9: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:484:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:488:13: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:488:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:489:20: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:489:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:500:21: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_read_support_filter_uu.c:499:21: call_function: calling 'ensure_in_buff_size' from 'uudecode_filter_read'
# 439| }
# 440| return (ARCHIVE_OK);
# 441|-> }
# 442|
# 443| static int
Error: GCC_ANALYZER_WARNING (CWE-835):
libarchive-3.8.4/libarchive/archive_read_support_format_cab.c:2774:17: warning[-Wanalyzer-infinite-loop]: infinite loop
# 2772|
# 2773| for (;;) {
# 2774|-> switch (state) {
# 2775| case ST_MAIN:
# 2776| for (;;) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_read_support_format_mtree.c: scope_hint: In function 'readline'
libarchive-3.8.4/libarchive/archive_read_support_format_mtree.c:2110:20: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 2110 | nl = memchr(t, '\n', bytes_read);
# | ^
# 2108| if (bytes_read < 0)
# 2109| return (ARCHIVE_FATAL);
# 2110|-> nl = memchr(t, '\n', bytes_read);
# 2111| /* If we found '\n', trim the read to end exactly there. */
# 2112| if (nl != NULL) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_read_support_format_mtree.c:2110:20: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 2108| if (bytes_read < 0)
# 2109| return (ARCHIVE_FATAL);
# 2110|-> nl = memchr(t, '\n', bytes_read);
# 2111| /* If we found '\n', trim the read to end exactly there. */
# 2112| if (nl != NULL) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_read_support_format_tar.c: scope_hint: In function 'readline'
libarchive-3.8.4/libarchive/archive_read_support_format_tar.c:3549:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 3549 | p = memchr(t, '\n', bytes_read);
# | ^
# 3547| return (ARCHIVE_FATAL);
# 3548| s = t; /* Start of line? */
# 3549|-> p = memchr(t, '\n', bytes_read);
# 3550| /* If we found '\n' in the read buffer, return pointer to that. */
# 3551| if (p != NULL) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_read_support_format_tar.c:3549:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 3547| return (ARCHIVE_FATAL);
# 3548| s = t; /* Start of line? */
# 3549|-> p = memchr(t, '\n', bytes_read);
# 3550| /* If we found '\n' in the read buffer, return pointer to that. */
# 3551| if (p != NULL) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_read_support_format_tar.c:3590:19: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 3590 | p = memchr(t, '\n', bytes_read);
# | ^
# 3588| return (ARCHIVE_FATAL);
# 3589| s = t; /* Start of line? */
# 3590|-> p = memchr(t, '\n', bytes_read);
# 3591| /* If we found '\n', trim the read. */
# 3592| if (p != NULL) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_read_support_format_tar.c:3590:19: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 3588| return (ARCHIVE_FATAL);
# 3589| s = t; /* Start of line? */
# 3590|-> p = memchr(t, '\n', bytes_read);
# 3591| /* If we found '\n', trim the read. */
# 3592| if (p != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-465):
libarchive-3.8.4/libarchive/archive_string.c:227:12: warning[-Wanalyzer-deref-before-check]: check of 'as' for NULL after already dereferencing it
libarchive-3.8.4/libarchive/archive_string.c:2289:1: enter_function: entry to 'best_effort_strncat_in_locale'
libarchive-3.8.4/libarchive/archive_string.c:2315:16: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_string.c:2316:20: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_string.c:2318:29: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_string.c:2318:28: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_string.c:2319:37: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_string.c:2319:37: call_function: calling 'archive_string_append' from 'best_effort_strncat_in_locale'
# 225| archive_string_append(struct archive_string *as, const char *p, size_t s)
# 226| {
# 227|-> if (archive_string_ensure(as, as->length + s + 1) == NULL)
# 228| return (NULL);
# 229| if (s)
Error: CPPCHECK_WARNING (CWE-457):
libarchive-3.8.4/libarchive/archive_util.c:461: error[uninitvar]: Uninitialized variable: rgid
# 459| if (getresgid(&ruid, &egid, &sgid) != 0)
# 460| return (-1);
# 461|-> if (rgid != egid || rgid != sgid)
# 462| return (1);
# 463| #elif HAVE_GETEUID
Error: GCC_ANALYZER_WARNING (CWE-457):
libarchive-3.8.4/libarchive/archive_util.c:461:12: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'rgid'
libarchive-3.8.4/libarchive/archive_util.c:455:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_util.c:457:13: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_util.c:457:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_util.c:459:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_util.c:461:13: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_util.c:461:12: danger: use of uninitialized value 'rgid' here
# 459| if (getresgid(&ruid, &egid, &sgid) != 0)
# 460| return (-1);
# 461|-> if (rgid != egid || rgid != sgid)
# 462| return (1);
# 463| #elif HAVE_GETEUID
Error: COMPILER_WARNING (CWE-457):
libarchive-3.8.4/libarchive/archive_util.c:461:12: warning[-Wmaybe-uninitialized]: 'rgid' may be used uninitialized
# 461 | if (rgid != egid || rgid != sgid)
# | ^
libarchive-3.8.4/libarchive/archive_util.c: scope_hint: In function '__archive_get_tempdir'
libarchive-3.8.4/libarchive/archive_util.c:454:15: note: 'rgid' was declared here
# 454 | gid_t rgid, egid, sgid;
# | ^~~~
# 459| if (getresgid(&ruid, &egid, &sgid) != 0)
# 460| return (-1);
# 461|-> if (rgid != egid || rgid != sgid)
# 462| return (1);
# 463| #elif HAVE_GETEUID
Error: GCC_ANALYZER_WARNING (CWE-401):
libarchive-3.8.4/libarchive/archive_write.c:123:16: warning[-Wanalyzer-malloc-leak]: leak of 'a'
libarchive-3.8.4/libarchive/archive_write.c:101:13: acquire_memory: allocated here
libarchive-3.8.4/libarchive/archive_write.c:102:12: branch_false: following 'false' branch (when 'a' is non-NULL)...
libarchive-3.8.4/libarchive/archive_write.c:104:9: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write.c:118:12: branch_false: following 'false' branch (when 'nulls' is non-NULL)...
libarchive-3.8.4/libarchive/archive_write.c:122:9: branch_false: ...to here
libarchive-3.8.4/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):
libarchive-3.8.4/libarchive/archive_write_add_filter_bzip2.c:181:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.8.4/libarchive/archive_write_add_filter_bzip2.c:168:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_write_add_filter_bzip2.c:170:21: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_write_add_filter_bzip2.c:180:36: acquire_memory: allocated here
libarchive-3.8.4/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):
libarchive-3.8.4/libarchive/archive_write_add_filter_gzip.c:210:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.8.4/libarchive/archive_write_add_filter_gzip.c:197:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_write_add_filter_gzip.c:199:21: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_write_add_filter_gzip.c:209:36: acquire_memory: allocated here
libarchive-3.8.4/libarchive/archive_write_add_filter_gzip.c:210:20: danger: 'malloc(bs)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 208| data->compressed_buffer_size = bs;
# 209| data->compressed = malloc(data->compressed_buffer_size);
# 210|-> if (data->compressed == NULL) {
# 211| archive_set_error(f->archive, ENOMEM,
# 212| "Can't allocate data for compression buffer");
Error: GCC_ANALYZER_WARNING (CWE-401):
libarchive-3.8.4/libarchive/archive_write_add_filter_xz.c:323:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.8.4/libarchive/archive_write_add_filter_xz.c:310:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_write_add_filter_xz.c:312:21: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_write_add_filter_xz.c:322:36: acquire_memory: allocated here
libarchive-3.8.4/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):
libarchive-3.8.4/libarchive/archive_write_add_filter_zstd.c:376:20: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(bs)'
libarchive-3.8.4/libarchive/archive_write_add_filter_zstd.c:362:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_write_add_filter_zstd.c:363:29: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_write_add_filter_zstd.c:375:33: acquire_memory: allocated here
libarchive-3.8.4/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: GCC_ANALYZER_WARNING (CWE-835):
libarchive-3.8.4/libarchive/archive_write_set_format_7zip.c:716:21: warning[-Wanalyzer-infinite-loop]: infinite loop
# 714| for (;;) {
# 715| /* Compress file data. */
# 716|-> r = compression_code(&(a->archive), &(zip->stream), run);
# 717| if (r != ARCHIVE_OK && r != ARCHIVE_EOF)
# 718| return (ARCHIVE_FATAL);
Error: GCC_ANALYZER_WARNING (CWE-401):
libarchive-3.8.4/libarchive/archive_write_set_format_cpio_binary.c:306:9: warning[-Wanalyzer-malloc-leak]: leak of 'newlist'
libarchive-3.8.4/libarchive/archive_write_set_format_cpio_binary.c:379:1: enter_function: entry to 'write_header'
libarchive-3.8.4/libarchive/archive_write_set_format_cpio_binary.c:431:15: call_function: calling 'synthesize_ino_value' from 'write_header'
# 304|
# 305| /* Assign a new index number. */
# 306|-> ino_new = (int)(++cpio->ino_next);
# 307|
# 308| /* Ensure space for the new mapping. */
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c: scope_hint: In function 'get_path_component'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:5532:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 5532 | p = strchr(fn, '/');
# | ^
# 5530| size_t l;
# 5531|
# 5532|-> p = strchr(fn, '/');
# 5533| if (p == NULL) {
# 5534| if ((l = strlen(fn)) == 0)
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:5532:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 5530| size_t l;
# 5531|
# 5532|-> p = strchr(fn, '/');
# 5533| if (p == NULL) {
# 5534| if ((l = strlen(fn)) == 0)
Error: GCC_ANALYZER_WARNING (CWE-401):
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:5828:1: warning[-Wanalyzer-malloc-leak]: leak of 'children'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:6995:1: enter_function: entry to 'isoent_make_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7006:21: call_function: calling 'isoent_alloc_path_table' from 'isoent_make_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7006:21: return_function: returning to 'isoent_make_path_table' from 'isoent_alloc_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7013:12: branch_false: following 'false' branch (when 'r == 0')...
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7015:13: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7015:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7025:9: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7025:9: call_function: calling 'isoent_collect_dirs' from 'isoent_make_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7025:9: return_function: returning to 'isoent_make_path_table' from 'isoent_collect_dirs'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7038:9: call_function: calling 'isofile_connect_hardlink_files' from 'isoent_make_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7038:9: return_function: returning to 'isoent_make_path_table' from 'isofile_connect_hardlink_files'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7046:13: call_function: calling 'isoent_traverse_tree' from 'isoent_make_path_table'
# 5826| }
# 5827| }
# 5828|-> }
# 5829|
# 5830| static void
Error: GCC_ANALYZER_WARNING (CWE-476):
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:6802:17: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:6995:1: enter_function: entry to 'isoent_make_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7006:21: call_function: calling 'isoent_alloc_path_table' from 'isoent_make_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7006:21: return_function: returning to 'isoent_make_path_table' from 'isoent_alloc_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7013:12: branch_false: following 'false' branch (when 'r == 0')...
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7015:13: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7015:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7025:9: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7025:9: call_function: calling 'isoent_collect_dirs' from 'isoent_make_path_table'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7025:9: return_function: returning to 'isoent_make_path_table' from 'isoent_collect_dirs'
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7031:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7032:21: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_iso9660.c:7032:21: call_function: calling 'isoent_rr_move' from 'isoent_make_path_table'
# 6800| * its sub directory entries move to rr_move too.
# 6801| */
# 6802|-> np = last->ptnext;
# 6803| }
# 6804|
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c: scope_hint: In function 'get_path_component'
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2047:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 2047 | p = strchr(fn, '/');
# | ^
# 2045| size_t l;
# 2046|
# 2047|-> p = strchr(fn, '/');
# 2048| if (p == NULL) {
# 2049| if ((l = strlen(fn)) == 0)
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2047:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 2045| size_t l;
# 2046|
# 2047|-> p = strchr(fn, '/');
# 2048| if (p == NULL) {
# 2049| if ((l = strlen(fn)) == 0)
Error: GCC_ANALYZER_WARNING (CWE-476):
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2234:23: warning[-Wanalyzer-null-dereference]: dereference of NULL 'dent'
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2065:1: enter_function: entry to 'mtree_entry_tree_add'
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2092:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2100:14: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2126:21: call_function: calling 'get_path_component' from 'mtree_entry_tree_add'
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2126:21: return_function: returning to 'mtree_entry_tree_add' from 'get_path_component'
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2127:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2131:20: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2131:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2137:20: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2163:12: branch_true: following 'true' branch (when 'np' is NULL)...
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2163:12: branch_true: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2167:24: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2210:17: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2210:17: release_memory: 'dent' is NULL
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2212:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2219:21: branch_false: ...to here
libarchive-3.8.4/libarchive/archive_write_set_format_mtree.c:2234:23: danger: dereference of NULL 'dent'
# 2232|
# 2233| if (!__archive_rb_tree_insert_node(
# 2234|-> &(dent->dir_info->rbtree),
# 2235| (struct archive_rb_node *)file)) {
# 2236| np = (struct mtree_entry *)__archive_rb_tree_find_node(
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_warc.c: scope_hint: In function '_popul_ehdr'
libarchive-3.8.4/libarchive/archive_write_set_format_warc.c:374:29: warning[-Wdiscarded-qualifiers]: initialization discards 'const' qualifier from pointer target type
# 374 | char *chk = strchr(hdr.tgturi, ':');
# | ^~~~~~
# 372| static const char _fil[] = "file://";
# 373| const char *u;
# 374|-> char *chk = strchr(hdr.tgturi, ':');
# 375|
# 376| if (chk != NULL && chk[1U] == '/' && chk[2U] == '/') {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_warc.c:374:29: warning[-Wdiscarded-qualifiers]: initialization discards 'const' qualifier from pointer target type
# 372| static const char _fil[] = "file://";
# 373| const char *u;
# 374|-> char *chk = strchr(hdr.tgturi, ':');
# 375|
# 376| if (chk != NULL && chk[1U] == '/' && chk[2U] == '/') {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_xar.c: scope_hint: In function 'get_path_component'
libarchive-3.8.4/libarchive/archive_write_set_format_xar.c:2276:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 2276 | p = strchr(fn, '/');
# | ^
# 2274| int l;
# 2275|
# 2276|-> p = strchr(fn, '/');
# 2277| if (p == NULL) {
# 2278| if ((l = (int)strlen(fn)) == 0)
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/libarchive/archive_write_set_format_xar.c:2276:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 2274| int l;
# 2275|
# 2276|-> p = strchr(fn, '/');
# 2277| if (p == NULL) {
# 2278| if ((l = (int)strlen(fn)) == 0)
Error: GCC_ANALYZER_WARNING (CWE-775):
libarchive-3.8.4/libarchive/filter_fork_posix.c:176:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'dup2(stdin_pipe[0], 0)'
libarchive-3.8.4/libarchive/filter_fork_posix.c:94:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:107:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:107:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:167:17: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:171:12: branch_false: following 'false' branch (when 'child != -1')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_true: following 'true' branch (when 'child == 0')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:174:17: branch_true: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:176:21: acquire_resource: opened here
libarchive-3.8.4/libarchive/filter_fork_posix.c:176:20: danger: 'dup2(stdin_pipe[0], 0)' leaks here; was opened at [(19)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/18)
# 174| close(stdin_pipe[1]);
# 175| close(stdout_pipe[0]);
# 176|-> if (dup2(stdin_pipe[0], 0 /* stdin */) == -1)
# 177| _exit(254);
# 178| if (stdin_pipe[0] != 0 /* stdin */)
Error: GCC_ANALYZER_WARNING:
libarchive-3.8.4/libarchive/filter_fork_posix.c:176:21: warning[-Wanalyzer-fd-use-without-check]: 'dup2' on possibly invalid file descriptor '0'
libarchive-3.8.4/libarchive/filter_fork_posix.c:94:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:107:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:107:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:110:28: branch_true: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:110:20: branch_false: following 'false' branch (when 'tmp != -1')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:112:17: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:112:17: release_resource: closed here
libarchive-3.8.4/libarchive/filter_fork_posix.c:171:12: branch_false: following 'false' branch (when 'child != -1')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_true: following 'true' branch (when 'child == 0')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:174:17: branch_true: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:176:21: danger: '0' could be invalid
# 174| close(stdin_pipe[1]);
# 175| close(stdout_pipe[0]);
# 176|-> if (dup2(stdin_pipe[0], 0 /* stdin */) == -1)
# 177| _exit(254);
# 178| if (stdin_pipe[0] != 0 /* stdin */)
Error: GCC_ANALYZER_WARNING (CWE-775):
libarchive-3.8.4/libarchive/filter_fork_posix.c:180:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'dup2(stdout_pipe[1], 1)'
libarchive-3.8.4/libarchive/filter_fork_posix.c:94:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:107:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:107:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:167:17: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:171:12: branch_false: following 'false' branch (when 'child != -1')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_true: following 'true' branch (when 'child == 0')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:174:17: branch_true: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:176:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:178:21: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:178:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:180:21: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:180:21: acquire_resource: opened here
libarchive-3.8.4/libarchive/filter_fork_posix.c:180:20: danger: 'dup2(stdout_pipe[1], 1)' leaks here; was opened at [(23)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/22)
# 178| if (stdin_pipe[0] != 0 /* stdin */)
# 179| close(stdin_pipe[0]);
# 180|-> if (dup2(stdout_pipe[1], 1 /* stdout */) == -1)
# 181| _exit(254);
# 182| if (stdout_pipe[1] != 1 /* stdout */)
Error: GCC_ANALYZER_WARNING:
libarchive-3.8.4/libarchive/filter_fork_posix.c:180:21: warning[-Wanalyzer-fd-use-without-check]: 'dup2' on possibly invalid file descriptor '1'
libarchive-3.8.4/libarchive/filter_fork_posix.c:94:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:96:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:99:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:101:12: branch_true: following 'true' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:102:28: branch_true: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:102:20: branch_false: following 'false' branch (when 'tmp != -1')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:104:17: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:104:17: release_resource: closed here
libarchive-3.8.4/libarchive/filter_fork_posix.c:107:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:13: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:109:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:167:17: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:171:12: branch_false: following 'false' branch (when 'child != -1')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:173:12: branch_true: following 'true' branch (when 'child == 0')...
libarchive-3.8.4/libarchive/filter_fork_posix.c:174:17: branch_true: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:176:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:178:21: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:178:20: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive/filter_fork_posix.c:180:21: branch_false: ...to here
libarchive-3.8.4/libarchive/filter_fork_posix.c:180:21: danger: '1' could be invalid
# 178| if (stdin_pipe[0] != 0 /* stdin */)
# 179| close(stdin_pipe[0]);
# 180|-> if (dup2(stdout_pipe[1], 1 /* stdout */) == -1)
# 181| _exit(254);
# 182| if (stdout_pipe[1] != 1 /* stdout */)
Error: CPPCHECK_WARNING (CWE-476):
libarchive-3.8.4/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):
libarchive-3.8.4/libarchive/xxhash.c:350:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'state'
libarchive-3.8.4/libarchive/xxhash.c:363:19: acquire_memory: this call could return NULL
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/libarchive_fe/passphrase.c:208:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/dev/tty", 2)'
libarchive-3.8.4/libarchive_fe/passphrase.c:178:12: branch_false: following 'false' branch (when 'bufsiz != 0')...
libarchive-3.8.4/libarchive_fe/passphrase.c:178:12: branch_false: ...to here
libarchive-3.8.4/libarchive_fe/passphrase.c:184:21: branch_true: following 'true' branch (when 'i != 23')...
libarchive-3.8.4/libarchive_fe/passphrase.c:185:17: branch_true: ...to here
libarchive-3.8.4/libarchive_fe/passphrase.c:193:12: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive_fe/passphrase.c:194:31: branch_false: ...to here
libarchive-3.8.4/libarchive_fe/passphrase.c:194:31: acquire_resource: opened here
libarchive-3.8.4/libarchive_fe/passphrase.c:193:13: branch_false: following 'false' branch...
libarchive-3.8.4/libarchive_fe/passphrase.c:208:12: branch_false: ...to here
libarchive-3.8.4/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: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/tar/bsdtar.c: scope_hint: In function ‘main’
libarchive-3.8.4/tar/bsdtar.c:381:30: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 381 | uptr = strchr(bsdtar->argument, ':');
# | ^
# 379| tptr = NULL;
# 380|
# 381|-> uptr = strchr(bsdtar->argument, ':');
# 382| if (uptr != NULL) {
# 383| if (uptr[1] == '\0') {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/tar/bsdtar.c:381:30: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 379| tptr = NULL;
# 380|
# 381|-> uptr = strchr(bsdtar->argument, ':');
# 382| if (uptr != NULL) {
# 383| if (uptr[1] == '\0') {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/tar/bsdtar.c:660:30: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 660 | uptr = strchr(bsdtar->argument, ':');
# | ^
# 658| tptr = NULL;
# 659|
# 660|-> uptr = strchr(bsdtar->argument, ':');
# 661| if (uptr != NULL) {
# 662| if (uptr[1] == 0) {
Error: COMPILER_WARNING (CWE-704):
libarchive-3.8.4/tar/bsdtar.c:660:30: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 658| tptr = NULL;
# 659|
# 660|-> uptr = strchr(bsdtar->argument, ':');
# 661| if (uptr != NULL) {
# 662| if (uptr[1] == 0) {
Error: CPPCHECK_WARNING (CWE-476):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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):
libarchive-3.8.4/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-682):
libarchive-3.8.4/tar/subst.c:171: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 169| if (*str != NULL)
# 170| memcpy(new_str, *str, old_len);
# 171|-> memcpy(new_str + old_len, append, len);
# 172| new_str[old_len + len] = '\0';
# 173| free(*str);
Error: CPPCHECK_WARNING (CWE-476):
libarchive-3.8.4/tar/subst.c:172: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_str
# 170| memcpy(new_str, *str, old_len);
# 171| memcpy(new_str + old_len, append, len);
# 172|-> new_str[old_len + len] = '\0';
# 173| free(*str);
# 174| *str = new_str;
Error: CPPCHECK_WARNING (CWE-682):
libarchive-3.8.4/tar/subst.c:193: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 191| if (*str != NULL)
# 192| memcpy(new_str, *str, old_len);
# 193|-> strcpy(new_str + old_len, append);
# 194| free(*str);
# 195| *str = new_str;
Error: CPPCHECK_WARNING (CWE-457):
libarchive-3.8.4/tar/util.c:777: warning[uninitvar]: Uninitialized variable: sw
# 775| if (ltime)
# 776| sw = strftime(tmp, sizeof(tmp), fmt, ltime);
# 777|-> if (!ltime || !sw)
# 778| sprintf(tmp, "-- -- ----");
# 779| fprintf(out, " %s ", tmp);
Error: CPPCHECK_WARNING (CWE-562):
libarchive-3.8.4/tar/write.c:367: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 365| struct archive_dir archive_dir;
# 366|
# 367|-> bsdtar->archive_dir = &archive_dir;
# 368| memset(&archive_dir, 0, sizeof(archive_dir));
# 369|