Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-688): [#def1]
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_read_support_format_rar.c: scope_hint: In function 'read_header'
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_read_support_format_rar.c:1683:3: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_read_support_format_rar.c:3792:8: note: in expansion of macro 'rar_br_read_ahead'
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_read_support_format_rar.c:3792:8: note: in expansion of macro 'rar_br_read_ahead'
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_read_support_format_rar.c: scope_hint: In function 'read_header'
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1681|     rar->filename_save = (char*)realloc(rar->filename_save,
# 1682|                                         filename_size + 1);
# 1683|->   memcpy(rar->filename_save, rar->filename, filename_size + 1);
# 1684|     rar->filename_save_size = filename_size;
# 1685|   

Error: CPPCHECK_WARNING (CWE-401): [#def2]
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_read_support_format_rar.c:3336: error[memleak]: Memory leak: filter
# 3334|     filter->globaldata = calloc(1, filter->globaldatalen);
# 3335|     if (!filter->globaldata)
# 3336|->     return NULL;
# 3337|     if (globaldata)
# 3338|       memcpy(filter->globaldata, globaldata, globaldatalen);

Error: GCC_ANALYZER_WARNING (CWE-415): [#def3]
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_util.c: scope_hint: In function 'archive_utility_string_sort_helper'
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_util.c:652:40: warning[-Wanalyzer-double-free]: double-'free' of 'lesser'
#  650|   		{
#  651|   			lesser_count++;
#  652|-> 			tmp = (char **)realloc(lesser,
#  653|   				lesser_count * sizeof(char *));
#  654|   			if (!tmp) {

Error: GCC_ANALYZER_WARNING (CWE-415): [#def4]
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_util.c:665:40: warning[-Wanalyzer-double-free]: double-'free' of 'greater'
#  663|   		{
#  664|   			greater_count++;
#  665|-> 			tmp = (char **)realloc(greater,
#  666|   				greater_count * sizeof(char *));
#  667|   			if (!tmp) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_write_set_format_shar.c: scope_hint: In function 'archive_write_shar_header'
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_write_set_format_shar.c:212:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'p' where non-null expected
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_write_set_format_shar.c:37: included_from: Included from here.
/usr/include/string.h:273:14: note: argument 1 of 'strrchr' must be non-null
#  210|   		/* Try to create the dir. */
#  211|   		p = strdup(name);
#  212|-> 		pp = strrchr(p, '/');
#  213|   		/* If there is a / character, try to create the dir. */
#  214|   		if (pp != NULL) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
libarchive-3.7.4-build/libarchive-3.7.4/libarchive/archive_write_set_format_shar.c:295:30: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'strdup(archive_entry_pathname(entry))' where non-null expected
/usr/include/string.h:273:14: note: argument 1 of 'strrchr' must be non-null
#  293|   			shar->last_dir = strdup(name);
#  294|   			/* Trim a trailing '/'. */
#  295|-> 			pp = strrchr(shar->last_dir, '/');
#  296|   			if (pp != NULL && pp[1] == '\0')
#  297|   				*pp = '\0';

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.82.0
diffbase-analyzer-version-cppcheck2.16.0
diffbase-analyzer-version-gcc14.2.1
diffbase-analyzer-version-gcc-analyzer15.0.0
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-224.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namelibarchive-3.7.7-1.fc42
diffbase-store-results-to/tmp/tmpe23uz3md/libarchive-3.7.7-1.fc42.tar.xz
diffbase-time-created2024-11-13 01:14:29
diffbase-time-finished2024-11-13 01:16:57
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpe23uz3md/libarchive-3.7.7-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpe23uz3md/libarchive-3.7.7-1.fc42.src.rpm'
diffbase-tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-224.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibarchive-3.7.4-3.fc41
store-results-to/tmp/tmpw985sbuu/libarchive-3.7.4-3.fc41.tar.xz
time-created2024-11-13 01:11:25
time-finished2024-11-13 01:14:12
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpw985sbuu/libarchive-3.7.4-3.fc41.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpw985sbuu/libarchive-3.7.4-3.fc41.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9