[llvm] r271170 - Don't let the readArray size calculation overflow
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sat May 28 23:18:01 PDT 2016
Author: majnemer
Date: Sun May 29 01:18:01 2016
New Revision: 271170
URL: http://llvm.org/viewvc/llvm-project?rev=271170&view=rev
Log:
Don't let the readArray size calculation overflow
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h?rev=271170&r1=271169&r2=271170&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h Sun May 29 01:18:01 2016
@@ -60,6 +60,8 @@ public:
return Error::success();
}
uint32_t Length = NumItems * sizeof(T);
+ if (Length / sizeof(T) != NumItems)
+ return make_error<CodeViewError>(cv_error_code::corrupt_record);
if (Offset + Length > Stream.getLength())
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
StreamRef View(Stream, Offset, Length);
More information about the llvm-commits
mailing list