capstone-5.0.1-6.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
capstone-5.0.1-build/capstone-5.0.1/arch/ARM/ARMInstPrinter.c: scope_hint: In function ‘printBankedRegOperand’
capstone-5.0.1-build/capstone-5.0.1/arch/ARM/ARMInstPrinter.c:1835:34: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
capstone-5.0.1-build/capstone-5.0.1/arch/ARM/ARMInstPrinter.c:37: included_from: Included from here.
# 1833|   	const BankedReg *TheReg = lookupBankedRegByEncoding(Banked);
# 1834|   
# 1835|-> 	SStream_concat0(O, TheReg->Name);
# 1836|   	ARM_addSysReg(MI, TheReg->sysreg);
# 1837|   }

Error: CPPCHECK_WARNING (CWE-758): [#def2]
capstone-5.0.1-build/capstone-5.0.1/arch/TriCore/TriCoreInstPrinter.c:246: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  244|   		uint64_t imm = MCOperand_getImm(MO);
#  245|   		for (unsigned i = n + 1; i < 32; ++i) {
#  246|-> 			imm &= ~(1 << i);
#  247|   		}
#  248|   		if (n == 4) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def3]
capstone-5.0.1-build/capstone-5.0.1/cs.c: scope_hint: In function ‘str_replace’
capstone-5.0.1-build/capstone-5.0.1/cs.c:554:30: warning[-Wanalyzer-null-argument]: use of NULL ‘str1’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  552|   {
#  553|   	// only perform replacement if the output fits into result
#  554|-> 	if (strlen(target) - strlen(str1) + strlen(str2) < CS_MNEMONIC_SIZE - 1)  {
#  555|   		// copy str2 to begining of result
#  556|   		strcpy(result, str2);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
capstone-5.0.1-build/capstone-5.0.1/cstool/cstool.c: scope_hint: In function ‘main’
capstone-5.0.1-build/capstone-5.0.1/cstool/cstool.c:156:26: warning[-Wanalyzer-malloc-leak]: leak of ‘preprocess(*<unknown>, & size)’
#  154|   	uint8_t *result;
#  155|   
#  156|-> 	if (strlen(code) == 0)
#  157|   		return NULL;
#  158|   

Error: CPPCHECK_WARNING (CWE-190): [#def5]
capstone-5.0.1-build/capstone-5.0.1/tests/test_basic.c:192: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_MIPS32+CS_MODE_BIG_ENDIAN'.
#  190|   		{
#  191|   			CS_ARCH_MIPS,
#  192|-> 			(cs_mode)(CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN),
#  193|   			(unsigned char*)MIPS_CODE,
#  194|   			sizeof(MIPS_CODE) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def6]
capstone-5.0.1-build/capstone-5.0.1/tests/test_basic.c:206: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_MIPS32R6+CS_MODE_MICRO+CS_MODE_BIG_ENDIAN'.
#  204|   		{
#  205|   			CS_ARCH_MIPS,
#  206|-> 			(cs_mode)(CS_MODE_MIPS32R6 + CS_MODE_MICRO + CS_MODE_BIG_ENDIAN),
#  207|   			(unsigned char*)MIPS_32R6M,
#  208|   			sizeof(MIPS_32R6M) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def7]
capstone-5.0.1-build/capstone-5.0.1/tests/test_basic.c:213: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_MIPS32R6+CS_MODE_BIG_ENDIAN'.
#  211|   		{
#  212|   			CS_ARCH_MIPS,
#  213|-> 			(cs_mode)(CS_MODE_MIPS32R6 + CS_MODE_BIG_ENDIAN),
#  214|   			(unsigned char*)MIPS_32R6,
#  215|   			sizeof(MIPS_32R6) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def8]
capstone-5.0.1-build/capstone-5.0.1/tests/test_basic.c:247: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_QPX'.
#  245|   		{
#  246|   			CS_ARCH_PPC,
#  247|-> 			CS_MODE_BIG_ENDIAN + CS_MODE_QPX,
#  248|   			(unsigned char*)PPC_CODE2,
#  249|   			sizeof(PPC_CODE2) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def9]
capstone-5.0.1-build/capstone-5.0.1/tests/test_basic.c:263: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_V9'.
#  261|   		{
#  262|   			CS_ARCH_SPARC,
#  263|-> 			(cs_mode)(CS_MODE_BIG_ENDIAN + CS_MODE_V9),
#  264|   			(unsigned char*)SPARCV9_CODE,
#  265|   			sizeof(SPARCV9_CODE) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def10]
capstone-5.0.1-build/capstone-5.0.1/tests/test_detail.c:160: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_MIPS32+CS_MODE_BIG_ENDIAN'.
#  158|   		{
#  159|   			CS_ARCH_MIPS,
#  160|-> 			(cs_mode)(CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN),
#  161|   			(unsigned char *)MIPS_CODE,
#  162|   			sizeof(MIPS_CODE) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def11]
capstone-5.0.1-build/capstone-5.0.1/tests/test_detail.c:174: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_MIPS32R6+CS_MODE_MICRO+CS_MODE_BIG_ENDIAN'.
#  172|   		{
#  173|   			CS_ARCH_MIPS,
#  174|-> 			(cs_mode)(CS_MODE_MIPS32R6 + CS_MODE_MICRO + CS_MODE_BIG_ENDIAN),
#  175|   			(unsigned char*)MIPS_32R6M,
#  176|   			sizeof(MIPS_32R6M) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def12]
capstone-5.0.1-build/capstone-5.0.1/tests/test_detail.c:181: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_MIPS32R6+CS_MODE_BIG_ENDIAN'.
#  179|   		{
#  180|   			CS_ARCH_MIPS,
#  181|-> 			(cs_mode)(CS_MODE_MIPS32R6 + CS_MODE_BIG_ENDIAN),
#  182|   			(unsigned char*)MIPS_32R6,
#  183|   			sizeof(MIPS_32R6) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def13]
capstone-5.0.1-build/capstone-5.0.1/tests/test_detail.c:206: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_QPX'.
#  204|   		{
#  205|   			CS_ARCH_PPC,
#  206|-> 			CS_MODE_BIG_ENDIAN + CS_MODE_QPX,
#  207|   			(unsigned char*)PPC_CODE2,
#  208|   			sizeof(PPC_CODE2) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def14]
capstone-5.0.1-build/capstone-5.0.1/tests/test_detail.c:222: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_V9'.
#  220|   		{
#  221|   			CS_ARCH_SPARC,
#  222|-> 			(cs_mode)(CS_MODE_BIG_ENDIAN + CS_MODE_V9),
#  223|   			(unsigned char*)SPARCV9_CODE,
#  224|   			sizeof(SPARCV9_CODE) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def15]
capstone-5.0.1-build/capstone-5.0.1/tests/test_iter.c:148: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_MIPS32+CS_MODE_BIG_ENDIAN'.
#  146|   		{
#  147|   			CS_ARCH_MIPS,
#  148|-> 			(cs_mode)(CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN),
#  149|   			(unsigned char *)MIPS_CODE,
#  150|   			sizeof(MIPS_CODE) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def16]
capstone-5.0.1-build/capstone-5.0.1/tests/test_iter.c:189: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_V9'.
#  187|   		{
#  188|   			CS_ARCH_SPARC,
#  189|-> 			(cs_mode)(CS_MODE_BIG_ENDIAN + CS_MODE_V9),
#  190|   			(unsigned char*)SPARCV9_CODE,
#  191|   			sizeof(SPARCV9_CODE) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def17]
capstone-5.0.1-build/capstone-5.0.1/tests/test_ppc.c:130: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_QPX'.
#  128|   		{
#  129|   			CS_ARCH_PPC,
#  130|-> 			(cs_mode)(CS_MODE_BIG_ENDIAN + CS_MODE_QPX),
#  131|   			(unsigned char*)PPC_CODE2,
#  132|   			sizeof(PPC_CODE2) - 1,

Error: CPPCHECK_WARNING (CWE-190): [#def18]
capstone-5.0.1-build/capstone-5.0.1/tests/test_ppc.c:137: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_PS'.
#  135|   		{
#  136|   			CS_ARCH_PPC,
#  137|-> 			(cs_mode)(CS_MODE_BIG_ENDIAN + CS_MODE_PS),
#  138|   			(unsigned char*)PPC_CODE3,
#  139|   			sizeof(PPC_CODE3) - 1,

Error: COMPILER_WARNING (CWE-704): [#def19]
capstone-5.0.1-build/capstone-5.0.1/tests/test_sh.c:66:9: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
#   66 |         "Register indirect",
#      |         ^~~~~~~~~~~~~~~~~~~
#   64|   
#   65|   static char *reg_address_msg[] = {
#   66|-> 	"Register indirect",
#   67|   	"Register indirect with predecrement",
#   68|   	"Register indirect with postincrement",

Error: COMPILER_WARNING (CWE-704): [#def20]
capstone-5.0.1-build/capstone-5.0.1/tests/test_sh.c:67:9: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
#   67 |         "Register indirect with predecrement",
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   65|   static char *reg_address_msg[] = {
#   66|   	"Register indirect",
#   67|-> 	"Register indirect with predecrement",
#   68|   	"Register indirect with postincrement",
#   69|   };

Error: COMPILER_WARNING (CWE-704): [#def21]
capstone-5.0.1-build/capstone-5.0.1/tests/test_sh.c:68:9: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
#   68 |         "Register indirect with postincrement",
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   66|   	"Register indirect",
#   67|   	"Register indirect with predecrement",
#   68|-> 	"Register indirect with postincrement",
#   69|   };
#   70|   

Error: COMPILER_WARNING: [#def22]
capstone-5.0.1-build/capstone-5.0.1/tests/test_sh.c: scope_hint: In function ‘print_insn_detail’
capstone-5.0.1-build/capstone-5.0.1/tests/test_sh.c:99:72: warning[-Wformat=]: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’}
#   99 |                         printf("\t\toperands[%u].type: IMMEDIATE = #%llu\n", i,
#      |                                                                     ~~~^
#      |                                                                        |
#      |                                                                        long long unsigned int
#      |                                                                     %lu
#  100 |                                op->imm);
#      |                                ~~~~~~~                                  
#      |                                  |
#      |                                  uint64_t {aka long unsigned int}
#   97|   
#   98|   		case SH_OP_IMM:
#   99|-> 			printf("\t\toperands[%u].type: IMMEDIATE = #%llu\n", i,
#  100|   			       op->imm);
#  101|   			break;

Error: CPPCHECK_WARNING (CWE-190): [#def23]
capstone-5.0.1-build/capstone-5.0.1/tests/test_sparc.c:95: error[integerOverflow]: Signed integer overflow for expression 'CS_MODE_BIG_ENDIAN+CS_MODE_V9'.
#   93|   		{
#   94|   			CS_ARCH_SPARC,
#   95|-> 			(cs_mode)(CS_MODE_BIG_ENDIAN + CS_MODE_V9),
#   96|   			(unsigned char*)SPARCV9_CODE,
#   97|   			sizeof(SPARCV9_CODE) - 1,

Error: COMPILER_WARNING (CWE-704): [#def24]
capstone-5.0.1-build/capstone-5.0.1/tests/test_tricore.c: scope_hint: In function ‘test’
capstone-5.0.1-build/capstone-5.0.1/tests/test_tricore.c:85:25: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
#   85 |                         "TriCore",
#      |                         ^~~~~~~~~
#   83|   			(unsigned char *)TRICORE_CODE,
#   84|   			sizeof(TRICORE_CODE) - 1,
#   85|-> 			"TriCore",
#   86|   		},
#   87|   	};

Error: COMPILER_WARNING (CWE-704): [#def25]
capstone-5.0.1-build/capstone-5.0.1/tests/test_tricore.c:112:42: warning[-Wdiscarded-qualifiers]: passing argument 1 of ‘print_string_hex’ discards ‘const’ qualifier from pointer target type
#  112 |                         print_string_hex("Code:", platforms[i].code,
#      |                                          ^~~~~~~
capstone-5.0.1-build/capstone-5.0.1/tests/test_tricore.c:19:36: note: expected ‘char *’ but argument is of type ‘const char *’
#   19 | static void print_string_hex(char *comment, unsigned char *str, size_t len)
#      |                              ~~~~~~^~~~~~~
#  110|   			printf("****************\n");
#  111|   			printf("Platform: %s\n", platforms[i].comment);
#  112|-> 			print_string_hex("Code:", platforms[i].code,
#  113|   					 platforms[i].size);
#  114|   			printf("Disasm:\n");

Error: COMPILER_WARNING (CWE-704): [#def26]
capstone-5.0.1-build/capstone-5.0.1/tests/test_tricore.c:130:42: warning[-Wdiscarded-qualifiers]: passing argument 1 of ‘print_string_hex’ discards ‘const’ qualifier from pointer target type
#  130 |                         print_string_hex("Code:", platforms[i].code,
#      |                                          ^~~~~~~
capstone-5.0.1-build/capstone-5.0.1/tests/test_tricore.c:19:36: note: expected ‘char *’ but argument is of type ‘const char *’
#   19 | static void print_string_hex(char *comment, unsigned char *str, size_t len)
#      |                              ~~~~~~^~~~~~~
#  128|   			printf("****************\n");
#  129|   			printf("Platform: %s\n", platforms[i].comment);
#  130|-> 			print_string_hex("Code:", platforms[i].code,
#  131|   					 platforms[i].size);
#  132|   			printf("ERROR: Failed to disasm given code!\n");

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-84.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namecapstone-5.0.1-6.fc42
store-results-to/tmp/tmpphfqsgfg/capstone-5.0.1-6.fc42.tar.xz
time-created2024-11-12 23:20:53
time-finished2024-11-12 23:24:01
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpphfqsgfg/capstone-5.0.1-6.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpphfqsgfg/capstone-5.0.1-6.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9