[llvm] r363260 - Extra error checking to ARMAttributeParser

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 06:25:20 PDT 2019


Author: evgeny777
Date: Thu Jun 13 06:25:20 2019
New Revision: 363260

URL: http://llvm.org/viewvc/llvm-project?rev=363260&view=rev
Log:
Extra error checking to ARMAttributeParser

The patch checks for subsection length as discussed in D63191

Modified:
    llvm/trunk/lib/Support/ARMAttributeParser.cpp

Modified: llvm/trunk/lib/Support/ARMAttributeParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ARMAttributeParser.cpp?rev=363260&r1=363259&r2=363260&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ARMAttributeParser.cpp (original)
+++ llvm/trunk/lib/Support/ARMAttributeParser.cpp Thu Jun 13 06:25:20 2019
@@ -709,6 +709,12 @@ void ARMAttributeParser::Parse(ArrayRef<
       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;
 




More information about the llvm-commits mailing list