forked from OSchip/llvm-project
Avoid overflow when computing the size of an array
llvm-svn: 271031
This commit is contained in:
parent
1d69da5279
commit
0e872f6475
|
@ -102,6 +102,10 @@ template <typename T, typename U> struct serialize_array_impl {
|
|||
return std::error_code();
|
||||
|
||||
uint32_t Size = sizeof(T) * N;
|
||||
|
||||
if (Size / sizeof(T) != N)
|
||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
||||
|
||||
if (Data.size() < Size)
|
||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
||||
|
||||
|
|
Loading…
Reference in New Issue