Skip to content

Commit d158236

Browse files
authored
Make sure allocate() doesn't overflow
Differential Revision: D78675995 Pull Request resolved: #12679
1 parent 76ed145 commit d158236

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

runtime/core/memory_allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class MemoryAllocator {
8484

8585
// If the end of this allocation exceeds the end of this allocator, print
8686
// error messages and return nullptr
87-
if (end > end_) {
87+
if (end > end_ || end < start) {
8888
ET_LOG(
8989
Error,
9090
"Memory allocation failed: %zuB requested (adjusted for alignment), %zuB available",

0 commit comments

Comments
 (0)