We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4014597 commit 42e3222Copy full SHA for 42e3222
runtime/core/hierarchical_allocator.h
@@ -57,6 +57,14 @@ class HierarchicalAllocator final {
57
uint32_t memory_id,
58
size_t offset_bytes,
59
size_t size_bytes) {
60
+ // Check for integer overflow in offset_bytes + size_bytes.
61
+ ET_CHECK_OR_RETURN_ERROR(
62
+ size_bytes <= SIZE_MAX - offset_bytes,
63
+ InvalidArgument,
64
+ "Integer overflow in offset_bytes (%" ET_PRIsize_t
65
+ ") + size_bytes (%" ET_PRIsize_t ")",
66
+ offset_bytes,
67
+ size_bytes);
68
ET_CHECK_OR_RETURN_ERROR(
69
memory_id < buffers_.size(),
70
InvalidArgument,
0 commit comments