Enhance the sanity check for block sizes; check that the resulting pointer is
pointing to the range [first character, last character] instead of just not after the last character. Patch by Yan Ivnitskiy! llvm-svn: 133867
This commit is contained in:
parent
1ba7c4d01e
commit
967e745530
|
@ -375,10 +375,12 @@ public:
|
|||
|
||||
// Check that the block wasn't partially defined, and that the offset isn't
|
||||
// bogus.
|
||||
if (AtEndOfStream() || NextChar+NumWords*4 > BitStream->getLastChar())
|
||||
const unsigned char *const SkipTo = NextChar + NumWords*4;
|
||||
if (AtEndOfStream() || SkipTo > BitStream->getLastChar() ||
|
||||
SkipTo < BitStream->getFirstChar())
|
||||
return true;
|
||||
|
||||
NextChar += NumWords*4;
|
||||
NextChar = SkipTo;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue