Skip to content

Commit

Permalink
[crt] fix heap corruption from bad allocation (apache#7735)
Browse files Browse the repository at this point in the history
The type of runtime->storage_pool was changed at some point from TVMNDArray to TVMGraphRuntimeStorageEntry. This change was not reflected in the call to the allocation for its buffer. If this unclaimed space is allocated to something else, data corruption will happen.
  • Loading branch information
rafzi authored Mar 24, 2021
1 parent 63d8e97 commit cfe2e28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/crt/graph_runtime/graph_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ int TVMGraphRuntime_SetupStorage(TVMGraphRuntime* runtime) {
}

// Allocate the space.
err = TVMPlatformMemoryAllocate(sizeof(TVMNDArray) * pool_entry_count, alloc_ctx,
err = TVMPlatformMemoryAllocate(sizeof(TVMGraphRuntimeStorageEntry) * pool_entry_count, alloc_ctx,
(void**)&runtime->storage_pool);
if (err != kTvmErrorNoError) {
fprintf(stderr, "memory allocate error: %08x", err);
Expand Down

0 comments on commit cfe2e28

Please sign in to comment.