Task #130878 - added.err

back to task #130878
download
Error: CPPCHECK_WARNING (CWE-682):
exfatprogs-1.4.2/fsck/fsck.c:1775: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1773|   	const size_t ss = 1 << bs->bsx.sect_size_bits;
# 1774|   	uint8_t *sectors = malloc(ss * 12);
# 1775|-> 	__le32 *const chks = (__le32*)(sectors + ss * 11);
# 1776|   	__le32 *const chks_end = (__le32*)(sectors + ss * 12);
# 1777|   	off_t idx = BOOT_SEC_IDX;

Error: CPPCHECK_WARNING (CWE-682):
exfatprogs-1.4.2/fsck/fsck.c:1776: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1774|   	uint8_t *sectors = malloc(ss * 12);
# 1775|   	__le32 *const chks = (__le32*)(sectors + ss * 11);
# 1776|-> 	__le32 *const chks_end = (__le32*)(sectors + ss * 12);
# 1777|   	off_t idx = BOOT_SEC_IDX;
# 1778|   	unsigned int checksum = 0;

Error: GCC_ANALYZER_WARNING (CWE-688):
exfatprogs-1.4.2/fsck/fsck.c:1798:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘sectors’ where non-null expected
exfatprogs-1.4.2/fsck/fsck.c:1774:28: acquire_memory: this call could return NULL
exfatprogs-1.4.2/fsck/fsck.c:1780:9: branch_true: following ‘true’ branch (when ‘ss > 511’)...
exfatprogs-1.4.2/fsck/fsck.c:1782:12: branch_true: ...to here
exfatprogs-1.4.2/fsck/fsck.c:1782:12: branch_false: following ‘false’ branch (when ‘sectors’ is non-NULL)...
exfatprogs-1.4.2/fsck/fsck.c:1789:54: branch_false: ...to here
exfatprogs-1.4.2/fsck/fsck.c:1791:12: branch_true: following ‘true’ branch (when ‘recursive != 0’)...
exfatprogs-1.4.2/fsck/fsck.c:1792:49: branch_true: ...to here
exfatprogs-1.4.2/fsck/fsck.c:1798:9: danger: argument 1 (‘sectors’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 1796|   		memset(bs->mbr.part_entries, 0, sizeof(bs->mbr.part_entries));
# 1797|   	}
# 1798|-> 	memcpy(sectors, bs, sizeof(struct pbr));
# 1799|   	memset(sectors + sizeof(struct pbr), 0, ss - sizeof(struct pbr));
# 1800|