diff --git a/arch/LoongArch/LoongArchMapping.c b/arch/LoongArch/LoongArchMapping.c index b32e42c685..e8a3746832 100644 --- a/arch/LoongArch/LoongArchMapping.c +++ b/arch/LoongArch/LoongArchMapping.c @@ -180,6 +180,9 @@ void LoongArch_rewrite_memory_operand(MCInst *MI) const loongarch_suppl_info *suppl_info = map_get_suppl_info(MI, loongarch_insns); + if (!suppl_info) + return; + if (suppl_info->memory_access == CS_AC_INVALID) { // not memory instruction return; diff --git a/arch/Xtensa/XtensaDisassembler.c b/arch/Xtensa/XtensaDisassembler.c index 3f53a7bde2..0fb216758c 100644 --- a/arch/Xtensa/XtensaDisassembler.c +++ b/arch/Xtensa/XtensaDisassembler.c @@ -211,7 +211,7 @@ static DecodeStatus DecodeMR01RegisterClass(MCInst *Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) { - if (RegNo > 2) + if (RegNo >= ARR_SIZE(MR01DecoderTable)) return MCDisassembler_Fail; unsigned Reg = MR01DecoderTable[RegNo]; @@ -970,7 +970,7 @@ static DecodeStatus readInstructionN(const uint8_t *Bytes, size_t BytesLen, *Insn = 0; for (unsigned i = 0; i < InstSize; i++) - *Insn |= (Bytes[i] << 8 * i); + *Insn |= (uint64_t)(Bytes[i]) << (8 * i); *Size = InstSize; return MCDisassembler_Success;