Extra error checking to ARMAttributeParser
The patch checks for subsection length as discussed in D63191
llvm-svn: 363260
diff --git a/llvm/lib/Support/ARMAttributeParser.cpp b/llvm/lib/Support/ARMAttributeParser.cpp
index 08b939a..65ee51f 100644
--- a/llvm/lib/Support/ARMAttributeParser.cpp
+++ b/llvm/lib/Support/ARMAttributeParser.cpp
@@ -709,6 +709,12 @@
SW->indent();
}
+ if (SectionLength == 0 || (SectionLength + Offset) > Section.size()) {
+ errs() << "invalid subsection length " << SectionLength << " at offset "
+ << Offset << "\n";
+ return;
+ }
+
ParseSubsection(Section.data() + Offset, SectionLength);
Offset = Offset + SectionLength;