parted-3.6-7.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
parted-3.6-build/parted-3.6/lib/ialloc.h:51:37: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(s + 1)'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'ximalloc'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'ximalloc'
#   49|   imalloc (idx_t s)
#   50|   {
#   51|->   return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem ();
#   52|   }
#   53|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
parted-3.6-build/parted-3.6/lib/ialloc.h:51:37: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(s)'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'ximalloc'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'ximalloc'
#   49|   imalloc (idx_t s)
#   50|   {
#   51|->   return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem ();
#   52|   }
#   53|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
parted-3.6-build/parted-3.6/lib/ialloc.h:81:10: warning[-Wanalyzer-malloc-leak]: leak of 'xicalloc(s, 1)'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xicalloc'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xicalloc'
#   79|         s = 0;
#   80|       }
#   81|->   return calloc (n, s);
#   82|   }
#   83|   

Error: CPPCHECK_WARNING (CWE-664): [#def4]
parted-3.6-build/parted-3.6/lib/long-options.c:76: error[va_end_missing]: va_list 'authors' was opened but not closed by va_end().
#   74|               version_etc_va (stdout, command_name, package, version, authors);
#   75|               exit (EXIT_SUCCESS);
#   76|->           }
#   77|   
#   78|           default:

Error: CPPCHECK_WARNING (CWE-664): [#def5]
parted-3.6-build/parted-3.6/lib/long-options.c:129: error[va_end_missing]: va_list 'authors' was opened but not closed by va_end().
#  127|               version_etc_va (stdout, command_name, package, version, authors);
#  128|               exit (EXIT_SUCCESS);
#  129|->           }
#  130|   
#  131|           default:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xmalloc'
parted-3.6-build/parted-3.6/lib/xmalloc.c:45:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(n)'
parted-3.6-build/parted-3.6/lib/xmalloc.c:22: included_from: Included from here.
parted-3.6-build/parted-3.6/lib/xmalloc.c:57:10: note: in expansion of macro 'XNMALLOC'
parted-3.6-build/parted-3.6/lib/xmalloc.c:57:10: note: in expansion of macro 'XNMALLOC'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xmalloc'
#   43|   xmalloc (size_t s)
#   44|   {
#   45|->   return nonnull (malloc (s));
#   46|   }
#   47|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
parted-3.6-build/parted-3.6/lib/xmalloc.c:45:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(s)'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xmalloc'
#   43|   xmalloc (size_t s)
#   44|   {
#   45|->   return nonnull (malloc (s));
#   46|   }
#   47|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xcalloc'
parted-3.6-build/parted-3.6/lib/xmalloc.c:298:10: warning[-Wanalyzer-malloc-leak]: leak of 'xcalloc(s, 1)'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xcalloc'
#  296|   xcalloc (size_t n, size_t s)
#  297|   {
#  298|->   return nonnull (calloc (n, s));
#  299|   }
#  300|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xmemdup'
parted-3.6-build/parted-3.6/lib/xmalloc.c:314:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmemdup(string,  strlen(string) + 1)'
parted-3.6-build/parted-3.6/lib/xmalloc.c: scope_hint: In function 'xmemdup'
#  312|   xmemdup (void const *p, size_t s)
#  313|   {
#  314|->   return memcpy (xmalloc (s), p, s);
#  315|   }
#  316|   

Error: CPPCHECK_WARNING (CWE-758): [#def10]
parted-3.6-build/parted-3.6/lib/xstrtol.c:54: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#   52|   {
#   53|     __strtol_t scaled;
#   54|->   if (INT_MULTIPLY_WRAPV (*x, scale_factor, &scaled))
#   55|       {
#   56|         *x = *x < 0 ? TYPE_MINIMUM (__strtol_t) : TYPE_MAXIMUM (__strtol_t);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def11]
parted-3.6-build/parted-3.6/libparted/arch/linux.c: scope_hint: In function '_dm_remove_partition'
parted-3.6-build/parted-3.6/libparted/arch/linux.c:2845:18: warning[-Wanalyzer-null-argument]: use of NULL 'vol_uuid' where non-null expected
parted-3.6-build/parted-3.6/lib/fcntl.h:67: included_from: Included from here.
parted-3.6-build/parted-3.6/libparted/arch/linux.c:31: included_from: Included from here.
/usr/include/fcntl.h:209:12: note: argument 1 of 'open' must be non-null
# 2843|           char            *part_name = _device_get_part_path (disk->dev, partno);
# 2844|   
# 2845|->         int fd = open (part_name, O_RDONLY | O_EXCL);
# 2846|           if (fd == -1) {
# 2847|                   if (errno == ENOENT)

Error: GCC_ANALYZER_WARNING (CWE-688): [#def12]
parted-3.6-build/parted-3.6/libparted/arch/linux.c:2845:18: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
/usr/include/fcntl.h:209:12: note: argument 1 of 'open' must be non-null
# 2843|           char            *part_name = _device_get_part_path (disk->dev, partno);
# 2844|   
# 2845|->         int fd = open (part_name, O_RDONLY | O_EXCL);
# 2846|           if (fd == -1) {
# 2847|                   if (errno == ENOENT)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def13]
parted-3.6-build/parted-3.6/libparted/disk.c: scope_hint: In function '_disk_raw_remove'
parted-3.6-build/parted-3.6/libparted/disk.c:1876:33: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
parted-3.6-build/parted-3.6/libparted/disk.c:38: included_from: Included from here.
parted-3.6-build/parted-3.6/libparted/disk.c:1713:9: note: in expansion of macro 'PED_ASSERT'
parted-3.6-build/parted-3.6/libparted/disk.c:1713:9: note: in expansion of macro 'PED_ASSERT'
parted-3.6-build/parted-3.6/libparted/disk.c:1866:9: note: in expansion of macro 'PED_ASSERT'
parted-3.6-build/parted-3.6/libparted/disk.c:1867:9: note: in expansion of macro 'PED_ASSERT'
parted-3.6-build/parted-3.6/libparted/disk.c:1867:9: note: in expansion of macro 'PED_ASSERT'
parted-3.6-build/parted-3.6/libparted/disk.c:1692:9: note: in expansion of macro 'PED_ASSERT'
# 1874|   		if (part->type & PED_PARTITION_LOGICAL) {
# 1875|   			ped_disk_extended_partition (disk)->part_list
# 1876|-> 				= part->next;
# 1877|   		} else {
# 1878|   			disk->part_list = part->next;

Error: CPPCHECK_WARNING (CWE-457): [#def14]
parted-3.6-build/parted-3.6/libparted/fs/hfs/probe.c:122: error[uninitvar]: Uninitialized variable: mdb->old_new.embedded.signature
#  120|   
#  121|   		if (!ped_geometry_read (geom, buf, 2, 1)
#  122|-> 		    || (mdb->old_new.embedded.signature
#  123|   			!= PED_CPU_TO_BE16 (HFSP_SIGNATURE))) {
#  124|   			ped_geometry_destroy (geom_ret);

Error: COMPILER_WARNING (CWE-681): [#def15]
parted-3.6-build/parted-3.6/libparted/fs/r/fat/bootsector.c: scope_hint: In function 'fat_boot_sector_set_boot_code'
parted-3.6-build/parted-3.6/libparted/fs/r/fat/bootsector.c:282:28: warning[-Wpointer-sign]: pointer targets in passing argument 1 of 'strcpy' differ in signedness
#  282 |         strcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE);
#      |                 ~~~~~~~~~~~^~~~~~~~~~
#      |                            |
#      |                            uint8_t * {aka unsigned char *}
/usr/include/features.h:511: included_from: Included from here.
/usr/include/assert.h:35: included_from: Included from here.
parted-3.6-build/parted-3.6/lib/config.h:2435: included_from: Included from here.
parted-3.6-build/parted-3.6/libparted/fs/r/fat/bootsector.c:20: included_from: Included from here.
/usr/include/bits/string_fortified.h:77:16: note: expected 'char *' but argument is of type 'uint8_t *' {aka 'unsigned char *'}
#   77 | __NTH (strcpy (__fortify_clang_overload_arg (char *, __restrict, __dest),
#      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  280|   	memcpy (bs->boot_jump, FAT_BOOT_JUMP, 3);
#  281|   	PED_ASSERT (sizeof(FAT_BOOT_CODE) < sizeof(bs->u.fat32.boot_code));
#  282|-> 	strcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE);
#  283|   	return 1;
#  284|   }

Error: CPPCHECK_WARNING (CWE-457): [#def16]
parted-3.6-build/parted-3.6/libparted/fs/r/hfs/advfs.c:205: error[uninitvar]: Uninitialized variable: ret_key->file_ID
#  203|   				       (HfsPrivateGenericKey*) &search,
#  204|   				       record, sizeof (record), NULL)
#  205|-> 		    || ret_key->file_ID != search.file_ID
#  206|   		    || ret_key->type != search.type) {
#  207|   			if (first_pass)

Error: CPPCHECK_WARNING (CWE-457): [#def17]
parted-3.6-build/parted-3.6/libparted/fs/r/hfs/advfs_plus.c:212: error[uninitvar]: Uninitialized variable: ret_key->file_ID
#  210|   					   (HfsPPrivateGenericKey*) &search,
#  211|   					   record, sizeof (record), NULL)
#  212|-> 		    || ret_key->file_ID != search.file_ID
#  213|   		    || ret_key->type != search.type) {
#  214|   			if (first_pass)

Error: CPPCHECK_WARNING (CWE-457): [#def18]
parted-3.6-build/parted-3.6/libparted/fs/r/hfs/file.c:91: error[uninitvar]: Uninitialized variable: ret_key->file_ID
#   89|   		return 0;
#   90|   
#   91|-> 	if (ret_key->file_ID != search.file_ID || ret_key->type != search.type)
#   92|   		return 0;
#   93|   

Error: CPPCHECK_WARNING (CWE-457): [#def19]
parted-3.6-build/parted-3.6/libparted/fs/r/hfs/file_plus.c:94: error[uninitvar]: Uninitialized variable: ret_key->file_ID
#   92|   		return 0;
#   93|   
#   94|-> 	if (ret_key->file_ID != search.file_ID || ret_key->type != search.type)
#   95|   		return 0;
#   96|   

Error: CPPCHECK_WARNING (CWE-457): [#def20]
parted-3.6-build/parted-3.6/libparted/fs/r/hfs/probe.c:79: error[uninitvar]: Uninitialized variable: mdb->signature
#   77|   	if ((geom->length < 5)
#   78|   	    || (!ped_geometry_read (geom, buf, 2, 1))
#   79|-> 	    || (mdb->signature != PED_CPU_TO_BE16 (HFS_SIGNATURE)) )
#   80|   		return NULL;
#   81|   

Error: COMPILER_WARNING (CWE-681): [#def21]
parted-3.6-build/parted-3.6/libparted/labels/atari.c: scope_hint: In function 'atari_probe'
parted-3.6-build/parted-3.6/libparted/labels/atari.c:261:62: warning[-Wpointer-sign]: pointer targets in passing argument 1 of 'atr_pid_known' differ in signedness
#  261 | #define atr_part_known(part, pid_list) (atr_pid_known ((part)->id, pid_list))
#      |                                                        ~~~~~~^~~~
#      |                                                              |
#      |                                                              uint8_t * {aka unsigned char *}
parted-3.6-build/parted-3.6/libparted/labels/atari.c:423:23: note: in expansion of macro 'atr_part_known'
#  423 |                    && atr_part_known (&table.icd_part[0], atr_known_icd_pid)) {
#      |                       ^~~~~~~~~~~~~~
parted-3.6-build/parted-3.6/libparted/labels/atari.c:233:28: note: expected 'const char *' but argument is of type 'uint8_t *' {aka 'unsigned char *'}
#  233 | atr_pid_known (const char* pid, const char** pid_list)
#      |                ~~~~~~~~~~~~^~~
#  259|   }
#  260|   
#  261|-> #define atr_part_known(part, pid_list) (atr_pid_known ((part)->id, pid_list))
#  262|   
#  263|   #define atr_part_valid(part, sz) (atr_part_used(part)\

Error: COMPILER_WARNING (CWE-681): [#def22]
parted-3.6-build/parted-3.6/libparted/labels/atari.c: scope_hint: In function 'atr_parse_add_rawpart'
parted-3.6-build/parted-3.6/libparted/labels/atari.c:555:39: warning[-Wpointer-sign]: pointer targets in passing argument 2 of 'atr_part_sysraw' differ in signedness
#  555 |         atr_part_sysraw (part, rawpart->id, rawpart->flag);
#      |                                ~~~~~~~^~~~
#      |                                       |
#      |                                       const uint8_t * {aka const unsigned char *}
parted-3.6-build/parted-3.6/libparted/labels/atari.c:512:50: note: expected 'const char *' but argument is of type 'const uint8_t *' {aka 'const unsigned char *'}
#  512 | atr_part_sysraw (PedPartition* part, const char* id, uint8_t flag)
#      |                                      ~~~~~~~~~~~~^~
#  553|   	else
#  554|   		part->fs_type = NULL;
#  555|-> 	atr_part_sysraw (part, rawpart->id, rawpart->flag);
#  556|   
#  557|   	const_exact = ped_constraint_exact (&part->geom);

Error: CPPCHECK_WARNING (CWE-457): [#def23]
parted-3.6-build/parted-3.6/libparted/labels/atari.c:1419: error[uninitvar]: Uninitialized variables: (disk=part->disk)->dev.dev, (disk=part->disk)->dev.type, (disk=part->disk)->dev.block_sizes, (disk=part->disk)->dev.part_list, (disk=part->disk)->dev.disk_specific, (disk=part->disk)->dev.needs_clobber, (disk=part->disk)->dev.update_mode
# 1417|   	PED_ASSERT (ext_part != NULL);
# 1418|   
# 1419|-> 	dev = (disk = part->disk) -> dev;
# 1420|   
# 1421|   	first_log = atr_find_first_log (disk);

Error: CPPCHECK_WARNING (CWE-457): [#def24]
parted-3.6-build/parted-3.6/libparted/labels/atari.c:1502: error[uninitvar]: Uninitialized variables: (disk=part->disk)->dev.dev, (disk=part->disk)->dev.type, (disk=part->disk)->dev.block_sizes, (disk=part->disk)->dev.part_list, (disk=part->disk)->dev.disk_specific, (disk=part->disk)->dev.needs_clobber, (disk=part->disk)->dev.update_mode
# 1500|   	PED_ASSERT (part->disk->dev != NULL);
# 1501|   
# 1502|-> 	dev = (disk = part->disk) -> dev;
# 1503|   	min = art_min_extended_geom (part);
# 1504|   

Error: CPPCHECK_WARNING (CWE-457): [#def25]
parted-3.6-build/parted-3.6/libparted/labels/dos.c:981: error[legacyUninitvar]: Uninitialized variable: head_size
#  979|   	}
#  980|   
#  981|-> 	if (!(head_size > 0))
#  982|   		return 0;
#  983|   	if (!(head_size <= 63))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
parted-3.6-build/parted-3.6/libparted/labels/gpt.c: scope_hint: In function 'gpt_partition_set_name'
parted-3.6-build/parted-3.6/libparted/labels/gpt.c:1708:41: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(name)'
# 1706|     free(gpt_part_data->translated_name);
# 1707|     gpt_part_data->translated_name = xstrdup(name);
# 1708|->   iconv_t conv = iconv_open ("UCS-2LE", nl_langinfo (CODESET));
# 1709|     if (conv == (iconv_t)-1)
# 1710|       goto err;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def27]
parted-3.6-build/parted-3.6/libparted/libparted.c: scope_hint: In function 'ped_calloc'
parted-3.6-build/parted-3.6/libparted/libparted.c:259:9: warning[-Wanalyzer-null-argument]: use of NULL 'ped_malloc(size)' where non-null expected
parted-3.6-build/parted-3.6/libparted/libparted.c:30: included_from: Included from here.
parted-3.6-build/parted-3.6/libparted/libparted.c:247:38: note: in expansion of macro '_'
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
#  257|           void* buf = ped_malloc (size);
#  258|   
#  259|->         memset (buf, 0, size);
#  260|   
#  261|           return buf;

Error: CPPCHECK_WARNING (CWE-401): [#def28]
parted-3.6-build/parted-3.6/parted/strlist.c:168: error[memleakOnRealloc]: Common realloc mistake: 'result' nulled but not freed upon failure
#  166|   		goto error;
#  167|   
#  168|-> 	result = realloc (result, strlen (result) + 1);
#  169|   	if (!result)
#  170|   		goto error;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
parted-3.6-build/parted-3.6/parted/strlist.c: scope_hint: In function 'str_list_convert'
parted-3.6-build/parted-3.6/parted/strlist.c:361:38: warning[-Wanalyzer-malloc-leak]: leak of 'str'
#  359|   	char*		str = xstrdup ("");
#  360|   
#  361|-> 	for (walk = list; walk; walk = walk->next) {
#  362|   		if (walk->str) {
#  363|   			char*	tmp = wchar_to_str (walk->str, 0);

Error: CPPCHECK_WARNING (CWE-401): [#def30]
parted-3.6-build/parted-3.6/parted/strlist.c:367: error[memleakOnRealloc]: Common realloc mistake: 'str' nulled but not freed upon failure
#  365|   			length += strlen (tmp);
#  366|   
#  367|-> 			str = realloc (str, length);
#  368|   			strcpy (str + pos, tmp);
#  369|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def31]
parted-3.6-build/parted-3.6/parted/strlist.c:368:25: warning[-Wanalyzer-null-argument]: use of NULL 'str' where non-null expected
<built-in>: note: argument 1 of '__builtin_strcpy' must be non-null
#  366|   
#  367|   			str = realloc (str, length);
#  368|-> 			strcpy (str + pos, tmp);
#  369|   
#  370|   			pos = length - 1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def32]
parted-3.6-build/parted-3.6/parted/table.c: scope_hint: In function 'table_add_row_from_strlist'
parted-3.6-build/parted-3.6/parted/table.c:155:26: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc((long unsigned int)str_list_length(list) * 8)'
#  153|           while (list)
#  154|           {
#  155|->                 row[i] = wcsdup (list->str);
#  156|                   if (row[i] == NULL)
#  157|                           xalloc_die ();

Error: GCC_ANALYZER_WARNING (CWE-476): [#def33]
parted-3.6-build/parted-3.6/parted/ui.c: scope_hint: In function '_readline'
parted-3.6-build/parted-3.6/parted/ui.c:576:49: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'line'
parted-3.6-build/parted-3.6/parted/ui.c:23: included_from: Included from here.
parted-3.6-build/parted-3.6/parted/ui.c:793:9: note: in expansion of macro 'PED_ASSERT'
parted-3.6-build/parted-3.6/parted/ui.c:795:9: note: in expansion of macro 'PED_ASSERT'
parted-3.6-build/parted-3.6/parted/ui.c:30: included_from: Included from here.
parted-3.6-build/parted-3.6/parted/ui.c: scope_hint: In function '_readline'
#  574|                   fflush (stdout);
#  575|                   line = (char*) malloc (256);
#  576|->                 if (fgets (line, 256, stdin) && strcmp (line, "") != 0) {
#  577|   #ifndef HAVE_LIBREADLINE
#  578|                           /* Echo the input line, to be consistent with

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-235.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-nameparted-3.6-7.fc42
store-results-to/tmp/tmpt02h1je_/parted-3.6-7.fc42.tar.xz
time-created2024-11-13 02:21:40
time-finished2024-11-13 02:24:32
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpt02h1je_/parted-3.6-7.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpt02h1je_/parted-3.6-7.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9