From: Eugene Leviant Date: Thu, 13 Jun 2019 13:25:20 +0000 (+0000) Subject: Extra error checking to ARMAttributeParser X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ff0ca62e507e8fdbd5e0dfeed8acda407a36e56;p=llvm Extra error checking to ARMAttributeParser The patch checks for subsection length as discussed in D63191 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363260 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/ARMAttributeParser.cpp b/lib/Support/ARMAttributeParser.cpp index 08b939a8734..65ee51f1319 100644 --- a/lib/Support/ARMAttributeParser.cpp +++ b/lib/Support/ARMAttributeParser.cpp @@ -709,6 +709,12 @@ void ARMAttributeParser::Parse(ArrayRef Section, bool isLittle) { 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;