Skip to content

Commit

Permalink
Fix CodeQL issue cpp/enum-index in mono (#101751)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabYourPitchforks authored May 1, 2024
1 parent 48a7d5f commit 08fc3b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/mono/mono/mini/mini-amd64.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static const char * const single_xmmregs [] = {
const char*
mono_arch_fregname (int reg)
{
if (reg < AMD64_XMM_NREG)
if (reg >= 0 && reg < AMD64_XMM_NREG)
return single_xmmregs [reg];
else
return "unknown";
Expand All @@ -136,7 +136,7 @@ mono_arch_fregname (int reg)
const char *
mono_arch_xregname (int reg)
{
if (reg < AMD64_XMM_NREG)
if (reg >= 0 && reg < AMD64_XMM_NREG)
return packed_xmmregs [reg];
else
return "unknown";
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/mini-s390x.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ mono_arch_fregname (int reg)
const char *
mono_arch_xregname (int reg)
{
if (reg < s390_VR_NREG)
if (reg >= 0 && reg < s390_VR_NREG)
return vrNames [reg];
else
return "unknown";
Expand Down

0 comments on commit 08fc3b9

Please sign in to comment.