mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
Verify sizes when trying to read a BitcodeAbbrevOp
Summary: Make sure the abbrev operands are valid and that we can read/skip them afterwards. Bug found with AFL fuzz. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9030 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -198,6 +198,8 @@ class BitstreamCursor {
|
||||
|
||||
|
||||
public:
|
||||
static const size_t MaxChunkSize = sizeof(word_t) * 8;
|
||||
|
||||
BitstreamCursor() { init(nullptr); }
|
||||
|
||||
explicit BitstreamCursor(BitstreamReader &R) { init(&R); }
|
||||
@@ -335,7 +337,7 @@ public:
|
||||
}
|
||||
|
||||
word_t Read(unsigned NumBits) {
|
||||
static const unsigned BitsInWord = sizeof(word_t) * 8;
|
||||
static const unsigned BitsInWord = MaxChunkSize;
|
||||
|
||||
assert(NumBits && NumBits <= BitsInWord &&
|
||||
"Cannot return zero or more than BitsInWord bits!");
|
||||
|
Reference in New Issue
Block a user