diff options
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 308986a..c24dcf0 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2107,11 +2107,15 @@ Error BitcodeReader::parseGlobalValueSymbolTable() { if (!MaybeRecord) return MaybeRecord.takeError(); switch (MaybeRecord.get()) { - case bitc::VST_CODE_FNENTRY: // [valueid, offset] + case bitc::VST_CODE_FNENTRY: { // [valueid, offset] + unsigned ValueID = Record[0]; + if (ValueID >= ValueList.size() || !ValueList[ValueID]) + return error("Invalid value reference in symbol table"); setDeferredFunctionInfo(FuncBitcodeOffsetDelta, - cast<Function>(ValueList[Record[0]]), Record); + cast<Function>(ValueList[ValueID]), Record); break; } + } } } |