[llvm] r271139 - [llvm-readobj] Validate the string table offset before using it
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sat May 28 12:45:50 PDT 2016
Author: majnemer
Date: Sat May 28 14:45:49 2016
New Revision: 271139
URL: http://llvm.org/viewvc/llvm-project?rev=271139&view=rev
Log:
[llvm-readobj] Validate the string table offset before using it
Modified:
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=271139&r1=271138&r2=271139&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Sat May 28 14:45:49 2016
@@ -794,14 +794,20 @@ void COFFDumper::printCodeViewSymbolSect
while (!Contents.empty()) {
const FrameData *FD;
error(consumeObject(Contents, FD));
+
+ if (FD->FrameFunc >= CVStringTable.size())
+ error(object_error::parse_failed);
+
+ StringRef FrameFunc =
+ CVStringTable.drop_front(FD->FrameFunc).split('\0').first;
+
DictScope S(W, "FrameData");
W.printHex("RvaStart", FD->RvaStart);
W.printHex("CodeSize", FD->CodeSize);
W.printHex("LocalSize", FD->LocalSize);
W.printHex("ParamsSize", FD->ParamsSize);
W.printHex("MaxStackSize", FD->MaxStackSize);
- W.printString("FrameFunc",
- CVStringTable.drop_front(FD->FrameFunc).split('\0').first);
+ W.printString("FrameFunc", FrameFunc);
W.printHex("PrologSize", FD->PrologSize);
W.printHex("SavedRegsSize", FD->SavedRegsSize);
W.printFlags("Flags", FD->Flags, makeArrayRef(FrameDataFlags));
More information about the llvm-commits
mailing list