summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorEugene Leviant <eleviant@accesssoftek.com>2019-06-13 13:25:20 +0000
committerEugene Leviant <eleviant@accesssoftek.com>2019-06-13 13:25:20 +0000
commit407c8f1f4932dc4fdbb0236029226449481684c5 (patch)
treec36cbdaea8760670519ac7a08f1644ac08cfa289 /llvm/lib/Support
parentd2cd9c23b4ec648a46fcc12f4b0972212df5051a (diff)
downloadbcm5719-llvm-407c8f1f4932dc4fdbb0236029226449481684c5.tar.gz
bcm5719-llvm-407c8f1f4932dc4fdbb0236029226449481684c5.zip
Extra error checking to ARMAttributeParser
The patch checks for subsection length as discussed in D63191 llvm-svn: 363260
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/ARMAttributeParser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Support/ARMAttributeParser.cpp b/llvm/lib/Support/ARMAttributeParser.cpp
index 08b939a8734..65ee51f1319 100644
--- a/llvm/lib/Support/ARMAttributeParser.cpp
+++ b/llvm/lib/Support/ARMAttributeParser.cpp
@@ -709,6 +709,12 @@ void ARMAttributeParser::Parse(ArrayRef<uint8_t> 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;
OpenPOWER on IntegriCloud