[llvm] r188448 - Tentative fix for global-buffer-overflow caused by r188426. Found by AddressSanitizer
Alexey Samsonov
samsonov at google.com
Thu Aug 15 00:11:34 PDT 2013
Author: samsonov
Date: Thu Aug 15 02:11:34 2013
New Revision: 188448
URL: http://llvm.org/viewvc/llvm-project?rev=188448&view=rev
Log:
Tentative fix for global-buffer-overflow caused by r188426. Found by AddressSanitizer
Modified:
llvm/trunk/lib/Target/R600/AMDGPUISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/R600/AMDGPUISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUISelDAGToDAG.cpp?rev=188448&r1=188447&r2=188448&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUISelDAGToDAG.cpp Thu Aug 15 02:11:34 2013
@@ -115,7 +115,10 @@ const TargetRegisterClass *AMDGPUDAGToDA
switch (N->getMachineOpcode()) {
default: {
const MCInstrDesc &Desc = TM.getInstrInfo()->get(N->getMachineOpcode());
- int RegClass = Desc.OpInfo[Desc.getNumDefs() + OpNo].RegClass;
+ unsigned OpIdx = Desc.getNumDefs() + OpNo;
+ if (OpIdx >= Desc.getNumOperands())
+ return NULL;
+ int RegClass = Desc.OpInfo[OpIdx].RegClass;
if (RegClass == -1) {
return NULL;
}
More information about the llvm-commits
mailing list