diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Bitcode/NaCl/Reader/NaClBitcodeHeader.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeHeader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeHeader.cpp index 5193417619..aa73b9cffa 100644 --- a/lib/Bitcode/NaCl/Reader/NaClBitcodeHeader.cpp +++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeHeader.cpp @@ -187,7 +187,7 @@ bool NaClBitcodeHeader::Read(const unsigned char *&BufPtr, return false; } -bool NaClBitcodeHeader::Read(StreamingMemoryObject *Bytes) { +bool NaClBitcodeHeader::Read(StreamableMemoryObject *Bytes) { unsigned NumFields; unsigned NumBytes; { @@ -197,12 +197,14 @@ bool NaClBitcodeHeader::Read(StreamingMemoryObject *Bytes) { return true; } uint8_t *Header = new uint8_t[NumBytes]; - bool results = + bool failed = Bytes->readBytes(2 * WordSize, NumBytes, Header, NULL) || - ReadFields(Header, Header + sizeof(Header), NumFields, NumBytes); + ReadFields(Header, Header + NumBytes, NumFields, NumBytes); delete[] Header; + if (failed) + return true; InstallFields(); - return results; + return false; } NaClBitcodeHeaderField * |