Skip to content

Commit 0563725

Browse files
GeorgeWebldrumm
authored andcommitted
[NFC][AMDGPU] Guard the custom fixups kind array from invalid access
Protect from accidental passing of an invalid MCFixupKind value which can cause an out-of-bounds access in the array. Reviewed by: arsenm Differential Revision: https://reviews.llvm.org/D158725
1 parent 976244b commit 0563725

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ const MCFixupKindInfo &AMDGPUAsmBackend::getFixupKindInfo(
185185
if (Kind < FirstTargetFixupKind)
186186
return MCAsmBackend::getFixupKindInfo(Kind);
187187

188+
assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() &&
189+
"Invalid kind!");
188190
return Infos[Kind - FirstTargetFixupKind];
189191
}
190192

0 commit comments

Comments
 (0)