diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-05-27 18:50:00 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-05-27 18:50:00 +0000 |
| commit | 0e872f6475c389de95dd48eb17a55117db48095e (patch) | |
| tree | ea2d3e000edf879e9d1482169bacedd396d3dd70 /llvm | |
| parent | 1d69da52798dc6fb274d733fa1656ef365e2b5b7 (diff) | |
| download | bcm5719-llvm-0e872f6475c389de95dd48eb17a55117db48095e.tar.gz bcm5719-llvm-0e872f6475c389de95dd48eb17a55117db48095e.zip | |
Avoid overflow when computing the size of an array
llvm-svn: 271031
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h b/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h index 0a11536e0de..ef44f9d9418 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h +++ b/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h @@ -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); |

