[Bitcode] AtEndOfStream should only check against the size if it's known.

This avoids an issue where AtEndOfStream mistakenly returns true at the /start/ of
a stream.

(In the rare case that the size is known and actually 0, the slow path will still
handle it correctly.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221840 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jordan Rose
2014-11-13 00:08:41 +00:00
parent de87c9165a
commit 2217648f91
3 changed files with 58 additions and 1 deletions

View File

@ -227,7 +227,7 @@ public:
bool AtEndOfStream() {
if (BitsInCurWord != 0)
return false;
if (Size == NextChar)
if (Size != 0 && Size == NextChar)
return true;
fillCurWord();
return BitsInCurWord == 0;