diff options
author | Nikita Popov <npopov@redhat.com> | 2022-02-09 14:14:04 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-02-09 14:23:30 +0100 |
commit | 72248712e58b8825f2b0857bde4a811eb484ea82 (patch) | |
tree | 351366b77c638b14dd310326802488b6e000a81d /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 73a961b9cca1ecaa16ca7d9a456961ab6510bd1c (diff) | |
download | llvm-72248712e58b8825f2b0857bde4a811eb484ea82.zip llvm-72248712e58b8825f2b0857bde4a811eb484ea82.tar.gz llvm-72248712e58b8825f2b0857bde4a811eb484ea82.tar.bz2 |
[Bitcode] Check minimum size of constant GEP record
Checking this early, because we may end up reading up to two
records before the operands.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 93bff30..26eee99 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2676,6 +2676,8 @@ Error BitcodeReader::parseConstants() { case bitc::CST_CODE_CE_GEP: // [ty, n x operands] case bitc::CST_CODE_CE_GEP_WITH_INRANGE_INDEX: { // [ty, flags, n x // operands] + if (Record.size() < 2) + return error("Constant GEP record must have at least two elements"); unsigned OpNum = 0; Type *PointeeType = nullptr; if (BitCode == bitc::CST_CODE_CE_GEP_WITH_INRANGE_INDEX || |