mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-02-12 09:58:42 +00:00
Fix potential array out of bounds
This commit is contained in:
parent
bb358745c6
commit
313ce264ac
@ -73,7 +73,7 @@ static DecodeStatus DecodeGPRRegisterClass(MCInst *Inst, uint64_t RegNo,
|
||||
{
|
||||
unsigned Reg = 0;
|
||||
|
||||
if (RegNo > sizeof(GPRDecoderTable))
|
||||
if (RegNo >= ARR_SIZE(GPRDecoderTable))
|
||||
return MCDisassembler_Fail;
|
||||
|
||||
// We must define our own mapping from RegNo to register identifier.
|
||||
@ -101,7 +101,7 @@ static DecodeStatus DecodeFPR32RegisterClass(MCInst *Inst, uint64_t RegNo,
|
||||
{
|
||||
unsigned Reg = 0;
|
||||
|
||||
if (RegNo > sizeof(FPR32DecoderTable))
|
||||
if (RegNo >= ARR_SIZE(FPR32DecoderTable))
|
||||
return MCDisassembler_Fail;
|
||||
|
||||
// We must define our own mapping from RegNo to register identifier.
|
||||
@ -141,7 +141,7 @@ static DecodeStatus DecodeFPR64RegisterClass(MCInst *Inst, uint64_t RegNo,
|
||||
{
|
||||
unsigned Reg = 0;
|
||||
|
||||
if (RegNo > sizeof(FPR64DecoderTable))
|
||||
if (RegNo >= ARR_SIZE(FPR64DecoderTable))
|
||||
return MCDisassembler_Fail;
|
||||
|
||||
// We must define our own mapping from RegNo to register identifier.
|
||||
|
@ -1898,7 +1898,7 @@ const char *TMS320C64x_group_name(csh handle, unsigned int id)
|
||||
#ifndef CAPSTONE_DIET
|
||||
unsigned int i;
|
||||
|
||||
if (id >= TMS320C64X_GRP_ENDING)
|
||||
if (id >= ARR_SIZE(group_name_maps))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < ARR_SIZE(group_name_maps); i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user