diff options
| author | Jinsong Ji <jji@us.ibm.com> | 2019-08-20 14:46:02 +0000 |
|---|---|---|
| committer | Jinsong Ji <jji@us.ibm.com> | 2019-08-20 14:46:02 +0000 |
| commit | cda334ba5417d7702be755adc2f8414c877f0482 (patch) | |
| tree | eb790275fc731b3257194bbb1504906e3430299c /llvm/lib | |
| parent | 16111d3795c72b6674a5a2875fe328e16d91966e (diff) | |
| download | bcm5719-llvm-cda334ba5417d7702be755adc2f8414c877f0482.tar.gz bcm5719-llvm-cda334ba5417d7702be755adc2f8414c877f0482.zip | |
[BlockExtractor] Avoid assert with wrong line format
Summary:
When the line format is wrong, we may end up accessing out of bound
memory. eg: the test with invalide line will cause assert.
Assertion `idx < size()' failed
The fix is to report fatal when we found mismatched line format.
Reviewers: qcolombet, volkan
Reviewed By: qcolombet
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66444
llvm-svn: 369389
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/IPO/BlockExtractor.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/BlockExtractor.cpp b/llvm/lib/Transforms/IPO/BlockExtractor.cpp index 6c365f3f3cb..56854fceac0 100644 --- a/llvm/lib/Transforms/IPO/BlockExtractor.cpp +++ b/llvm/lib/Transforms/IPO/BlockExtractor.cpp @@ -119,6 +119,8 @@ void BlockExtractor::loadFile() { /*KeepEmpty=*/false); if (LineSplit.empty()) continue; + if (LineSplit.size()!=2) + report_fatal_error("Invalid line format, expecting lines like: 'funcname bb1[;bb2..]'"); SmallVector<StringRef, 4> BBNames; LineSplit[1].split(BBNames, ';', /*MaxSplit=*/-1, /*KeepEmpty=*/false); |

