erofs-utils-1.8.2-2.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-415): [#def1]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fsck/main.c: scope_hint: In function ‘erofs_verify_inode_data’
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fsck/main.c:614:45: warning[-Wanalyzer-double-free]: double-‘free’ of ‘buffer’
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/internal.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/compress.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fsck/main.c:14: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fsck/main.c:718:9: note: in expansion of macro ‘list_for_each_entry’
#  612|   
#  613|   				buffer_size = map.m_llen;
#  614|-> 				newbuffer = realloc(buffer, buffer_size);
#  615|   				if (!newbuffer) {
#  616|   					ret = -ENOMEM;

Error: CPPCHECK_WARNING (CWE-401): [#def2]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fsck/main.c:741: error[memleak]: Memory leak: entry
#  739|   	list_add_tail(&entry->list,
#  740|   		      &erofsfsck_link_hashtable[nid % NR_HARDLINK_HASHTABLE]);
#  741|-> 	return 0;
#  742|   }
#  743|   

Error: GCC_ANALYZER_WARNING (CWE-479): [#def3]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fuse/main.c:619:17: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘free’ from within signal handler
#  617|   		for (i = 0; i < nptrs; i++)
#  618|   			erofs_dump("%s\n", strings[i]);
#  619|-> 		free(strings);
#  620|   	}
#  621|   	erofs_dump("========================================\n");

Error: GCC_ANALYZER_WARNING (CWE-457): [#def4]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/flex-array.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/hashmap.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c:8: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c: scope_hint: In function 'erofs_blob_write_chunk_indexes'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/defs.h:125:31: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'extent_end'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c:192:22: note: in expansion of macro 'min'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c:191:15: note: in expansion of macro 'roundup'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c:192:22: note: in expansion of macro 'min'
#  123|   	typeof(y) _min2 = (y);			\
#  124|   	(void) (&_min1 == &_min2);		\
#  125|-> 	_min1 < _min2 ? _min1 : _min2; })
#  126|   
#  127|   #define max(x, y) ({				\

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/hashmap.h:71:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'e'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/hashmap.c: scope_hint: In function 'memintern'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/hashmap.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/hashmap.c:274:17: note: in expansion of macro 'FLEX_ALLOC_MEM'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/hashmap.c: scope_hint: In function 'memintern'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/hashmap.c:274:17: note: in expansion of macro 'FLEX_ALLOC_MEM'
#   69|   	struct hashmap_entry *e = entry;
#   70|   
#   71|-> 	e->hash = hash;
#   72|   	e->next = NULL;
#   73|   }

Error: GCC_ANALYZER_WARNING (CWE-835): [#def6]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/internal.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/inode.h:16: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:20: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c: scope_hint: In function 'erofs_iput.part.0'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/list.h:130:14: warning[-Wanalyzer-infinite-loop]: infinite loop
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:137:9: note: in expansion of macro 'list_for_each_entry_safe'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:137:9: note: in expansion of macro 'list_for_each_entry_safe'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:137:9: note: in expansion of macro 'list_for_each_entry_safe'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/config.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/print.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:18: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/list.h:93:39: note: in expansion of macro 'container_of'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/list.h:102:9: note: in expansion of macro 'list_entry'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/list.h:131:27: note: in expansion of macro 'list_next_entry'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:137:9: note: in expansion of macro 'list_for_each_entry_safe'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:137:9: note: in expansion of macro 'list_for_each_entry_safe'
#  128|   	for (pos = list_first_entry(head, typeof(*pos), member),               \
#  129|   	    n    = list_next_entry(pos, member);                               \
#  130|-> 	     &pos->member != (head);                                           \
#  131|   	     pos = n, n = list_next_entry(n, member))
#  132|   

Error: GCC_ANALYZER_WARNING (CWE-479): [#def7]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fuse/main.c:12: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fuse/main.c: scope_hint: In function ‘signal_handle_sigsegv’
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/print.h:80:30: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘fprintf’ from within signal handler
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fuse/main.c:618:25: note: in expansion of macro ‘erofs_dump’
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/print.h:80:53: note: in definition of macro ‘erofs_dump’
erofs-utils-1.8.2-build/erofs-utils-1.8.2/fuse/main.c:618:25: note: in expansion of macro ‘erofs_dump’
#   78|   } while (0)
#   79|   
#   80|-> #define erofs_dump(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
#   81|   
#   82|   #ifdef __cplusplus

Error: GCC_ANALYZER_WARNING (CWE-457): [#def8]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c: scope_hint: In function 'erofs_blob_mergechunks'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c:224:25: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*<unknown>'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/defs.h:107:31: note: in definition of macro 'roundup'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/internal.h:58:24: note: in expansion of macro 'erofs_blksiz'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c:305:22: note: in expansion of macro 'BLK_ROUND_UP'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/blobchunk.c: scope_hint: In function 'erofs_blob_mergechunks'
#  222|   	for (dst = src = 0; dst < count; ++dst) {
#  223|   		*((void **)inode->chunkindexes + dst) =
#  224|-> 			*((void **)inode->chunkindexes + src);
#  225|   		src += 1U << (new_chunkbits - chunkbits);
#  226|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/compress.c: scope_hint: In function 'z_erofs_compress_dedupe'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/compress.c:376:20: warning[-Wanalyzer-malloc-leak]: leak of 'sctx.pivot'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/config.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/print.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/compress.c:14: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/defs.h:140:24: note: in definition of macro 'min_t'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/compress.c: scope_hint: In function 'z_erofs_compress_dedupe'
#  374|   out:
#  375|   	z_erofs_commit_extent(ctx, ei);
#  376|-> 	ctx->pivot = NULL;
#  377|   	return 0;
#  378|   }

Error: CPPCHECK_WARNING (CWE-401): [#def10]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/compressor_liblzma.c:110: error[memleak]: Memory leak: ctx
#  108|   
#  109|   	if (lzma_lzma_preset(&ctx->opt, preset))
#  110|-> 		return -EINVAL;
#  111|   	ctx->opt.dict_size = c->dict_size;
#  112|   

Error: CPPCHECK_WARNING (CWE-758): [#def11]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/compressor_libzstd.c:90: error[shiftTooManyBits]: Shifting 32-bit value by 63 bits is undefined behaviour
#   88|   			dict_size = min_t(u32, Z_EROFS_ZSTD_MAX_DICT_SIZE,
#   89|   					  cfg.c_mkfs_pclustersize_max << 3);
#   90|-> 			dict_size = 1 << ilog2(dict_size);
#   91|   		}
#   92|   	}

Error: CPPCHECK_WARNING (CWE-758): [#def12]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/compressor_libzstd.c:93: error[shiftTooManyBits]: Shifting 32-bit value by 63 bits is undefined behaviour
#   91|   		}
#   92|   	}
#   93|-> 	if (dict_size != 1 << ilog2(dict_size) ||
#   94|   	    dict_size > Z_EROFS_ZSTD_MAX_DICT_SIZE) {
#   95|   		erofs_err("invalid dictionary size %u", dict_size);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def13]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/config.c: scope_hint: In function 'erofs_trim_for_progressinfo'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/config.c:142:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 's'
#  140|   
#  141|   		if (col > placeholder + 2) {
#  142|-> 			s[0] = '[';
#  143|   			s[1] = ']';
#  144|   		}

Error: COMPILER_WARNING (CWE-681): [#def14]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/decompress.c: scope_hint: In function 'z_erofs_qpl_get_job'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/decompress.c:136:59: warning[-Wpointer-sign]: pointer targets in passing argument 2 of 'qpl_get_job_size' differ in signedness
#  136 |                 status = qpl_get_job_size(execution_path, &jobsize);
#      |                                                           ^~~~~~~~
#      |                                                           |
#      |                                                           int32_t * {aka int *}
/usr/include/qpl/qpl.h:23: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/decompress.c:81: included_from: Included from here.
/usr/include/qpl/c_api/job.h:161:1: note: expected 'uint32_t *' {aka 'unsigned int *'} but argument is of type 'int32_t *' {aka 'int *'}
#  161 | QPL_API(qpl_status, qpl_get_job_size, (qpl_path_t qpl_path, uint32_t * job_size_ptr))
#      | ^~~~~~~
#  134|   
#  135|   	if (!job) {
#  136|-> 		status = qpl_get_job_size(execution_path, &jobsize);
#  137|   		if (status != QPL_STS_OK) {
#  138|   			erofs_err("failed to get job size: %d", status);

Error: CPPCHECK_WARNING (CWE-457): [#def15]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/dir.c:168: error[uninitvar]: Uninitialized variable: de->nameoff
#  166|   		}
#  167|   
#  168|-> 		nameoff = le16_to_cpu(de->nameoff);
#  169|   		if (nameoff < sizeof(struct erofs_dirent) ||
#  170|   		    nameoff >= erofs_blksiz(sbi)) {

Error: GCC_ANALYZER_WARNING (CWE-122): [#def16]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/fragments.c: scope_hint: In function 'z_erofs_fragments_dedupe_find'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/fragments.c:99:63: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/internal.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/inode.h:16: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/fragments.c:22: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/fragments.c:89:9: note: in expansion of macro 'list_for_each_entry'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/list.h:15: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/fragments.c:98:22: note: in expansion of macro 'min'
#   97|   
#   98|   		mn = min(e1, e2);
#   99|-> 		while (i < mn && cur->data[e1 - i - 1] == data[e2 - i - 1])
#  100|   			++i;
#  101|   

Error: CPPCHECK_WARNING (CWE-401): [#def17]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/fragments.c:194: error[memleak]: Memory leak: di
#  192|   
#  193|   	list_add_tail(&di->list, &dupli_frags[FRAGMENT_HASH(crc)]);
#  194|-> 	return 0;
#  195|   }
#  196|   

Error: GCC_ANALYZER_WARNING (CWE-415): [#def18]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:138:17: warning[-Wanalyzer-double-free]: double-'free' of 'd'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:12: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:111:9: note: in expansion of macro 'list_for_each_entry'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:137:9: note: in expansion of macro 'list_for_each_entry_safe'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:137:9: note: in expansion of macro 'list_for_each_entry_safe'
#  136|   
#  137|   	list_for_each_entry_safe(d, t, &inode->i_subdirs, d_child)
#  138|-> 		free(d);
#  139|   
#  140|   	free(inode->compressmeta);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c: scope_hint: In function 'erofs_init_empty_dir'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:221:24: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c: scope_hint: In function 'erofs_init_empty_dir'
#  219|   	d = erofs_d_alloc(dir, ".");
#  220|   	if (IS_ERR(d))
#  221|-> 		return PTR_ERR(d);
#  222|   	d->inode = erofs_igrab(dir);
#  223|   	d->type = EROFS_FT_DIR;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:226:13: warning[-Wanalyzer-malloc-leak]: leak of 'erofs_d_alloc(dir, ".")'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/atomic.h:29:28: note: in definition of macro 'erofs_atomic_add_return'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/inode.h:20:15: note: in expansion of macro 'erofs_atomic_inc_return'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c: scope_hint: In function 'erofs_init_empty_dir'
#  224|   
#  225|   	/* dotdot is pointed to the parent dir */
#  226|-> 	d = erofs_d_alloc(dir, "..");
#  227|   	if (IS_ERR(d))
#  228|   		return PTR_ERR(d);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:228:24: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/atomic.h:29:28: note: in definition of macro 'erofs_atomic_add_return'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/include/erofs/inode.h:20:15: note: in expansion of macro 'erofs_atomic_inc_return'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c: scope_hint: In function 'erofs_init_empty_dir'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c: scope_hint: In function 'erofs_init_empty_dir'
#  226|   	d = erofs_d_alloc(dir, "..");
#  227|   	if (IS_ERR(d))
#  228|-> 		return PTR_ERR(d);
#  229|   	d->inode = erofs_igrab(erofs_parent_inode(dir));
#  230|   	d->type = EROFS_FT_DIR;

Error: CPPCHECK_WARNING (CWE-457): [#def22]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:379: error[uninitvar]: Uninitialized variable: de->nameoff
#  377|   			return err;
#  378|   
#  379|-> 		nameoff = le16_to_cpu(de->nameoff);
#  380|   		if (nameoff < sizeof(struct erofs_dirent) ||
#  381|   		    nameoff >= count) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c: scope_hint: In function 'erofs_mkfs_build_special_from_fd'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:1912:17: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:1090:25: note: in expansion of macro 'erofs_err'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/inode.c:1090:25: note: in expansion of macro 'erofs_err'
# 1910|   	ret = erofs_fill_inode(inode, &st, name);
# 1911|   	if (ret) {
# 1912|-> 		free(inode);
# 1913|   		return ERR_PTR(ret);
# 1914|   	}

Error: CPPCHECK_WARNING (CWE-457): [#def24]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/namei.c:222: error[uninitvar]: Uninitialized variable: de->nameoff
#  220|   			return ret;
#  221|   
#  222|-> 		nameoff = le16_to_cpu(de->nameoff);
#  223|   		if (nameoff < sizeof(struct erofs_dirent) ||
#  224|   		    nameoff >= erofs_blksiz(sbi)) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def25]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/rebuild.c: scope_hint: In function 'erofs_rebuild_dirent_iter'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/rebuild.c:297:14: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/rebuild.c:11: included_from: Included from here.
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/rebuild.c:286:9: note: in expansion of macro 'erofs_dbg'
#  295|   
#  296|   	ret = 0;
#  297|-> 	if (d->type != EROFS_FT_UNKNOWN) {
#  298|   		/*
#  299|   		 * bail out if the file exists in the upper layers.  (Note that

Error: CPPCHECK_WARNING (CWE-758): [#def26]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/super.c:50: error[shiftTooManyBits]: Shifting 64-bit value by 64 bits is undefined behaviour
#   48|   
#   49|   	sbi->extra_devices = ondisk_extradevs;
#   50|-> 	sbi->device_id_mask = roundup_pow_of_two(ondisk_extradevs + 1) - 1;
#   51|   	sbi->devs = calloc(ondisk_extradevs, sizeof(*sbi->devs));
#   52|   	if (!sbi->devs)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def27]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/tar.c: scope_hint: In function 'erofs_iostream_bread'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/tar.c:235:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'src'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/tar.c: scope_hint: In function 'erofs_iostream_bread'
#  233|   		if (ret < 0)
#  234|   			return ret;
#  235|-> 		memcpy(buf, src, ret);
#  236|   		rem -= ret;
#  237|   	} while (rem && ret);

Error: GCC_ANALYZER_WARNING (CWE-457): [#def28]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/tar.c: scope_hint: In function 'tarerofs_parse_tar'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/tar.c:700:32: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'th'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/tar.c: scope_hint: In function 'tarerofs_parse_tar'
#  698|   
#  699|   	/* chksum field itself treated as ' ' */
#  700|-> 	csum = tarerofs_otoi(th->chksum, sizeof(th->chksum));
#  701|   	if (errno) {
#  702|   		if (*th->name == '\0') {

Error: CPPCHECK_WARNING (CWE-401): [#def29]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/xattr.c:357: error[memleak]: Memory leak: node
#  355|   	node->item = item;
#  356|   	list_add(&node->list, hlist);
#  357|-> 	return 0;
#  358|   }
#  359|   

Error: CPPCHECK_WARNING (CWE-476): [#def30]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/xattr.c:491: warning[nullPointer]: Possible null pointer dereference: value
#  489|   
#  490|   	memcpy(kvbuf, key, EROFS_XATTR_KSIZE(len));
#  491|-> 	memcpy(kvbuf + EROFS_XATTR_KSIZE(len), value, size);
#  492|   
#  493|   	item = get_xattritem(kvbuf, len);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def31]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/xattr.c: scope_hint: In function 'xattr_entrylist'
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/xattr.c:1492:9: warning[-Wanalyzer-null-argument]: use of NULL 'infix' where non-null expected
<built-in>: note: argument 2 of '__builtin_memcpy' must be non-null
# 1490|   
# 1491|   	memcpy(it->buffer + it->buffer_ofs, prefix, prefix_len);
# 1492|-> 	memcpy(it->buffer + it->buffer_ofs + prefix_len, infix, infix_len);
# 1493|   	it->buffer_ofs += prefix_len + infix_len;
# 1494|   	return 0;

Error: CPPCHECK_WARNING (CWE-401): [#def32]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/lib/xattr.c:1621: error[memleak]: Memory leak: tnode
# 1619|   	init_list_head(&tnode->list);
# 1620|   	list_add_tail(&tnode->list, &ea_name_prefixes);
# 1621|-> 	return 0;
# 1622|   }
# 1623|   

Error: CPPCHECK_WARNING (CWE-758): [#def33]
erofs-utils-1.8.2-build/erofs-utils-1.8.2/mkfs/main.c:719: error[shiftTooManyBits]: Shifting 32-bit value by 63 bits is undefined behaviour
#  717|   			}
#  718|   			cfg.c_chunkbits = ilog2(i);
#  719|-> 			if ((1 << cfg.c_chunkbits) != i) {
#  720|   				erofs_err("chunksize %s must be a power of two",
#  721|   					  optarg);

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-17.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-nameerofs-utils-1.8.2-2.fc42
store-results-to/tmp/tmpdl1cqsii/erofs-utils-1.8.2-2.fc42.tar.xz
time-created2024-11-12 23:47:08
time-finished2024-11-12 23:49:09
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpdl1cqsii/erofs-utils-1.8.2-2.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpdl1cqsii/erofs-utils-1.8.2-2.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9