Skip to content

fix: prevent integer overflow in memory size calculation for tensors#16481

Open
chunseoklee wants to merge 4 commits intoSamsung:masterfrom
chunseoklee:bounty
Open

fix: prevent integer overflow in memory size calculation for tensors#16481
chunseoklee wants to merge 4 commits intoSamsung:masterfrom
chunseoklee:bounty

Conversation

@chunseoklee
Copy link
Copy Markdown
Contributor

This commit addresses potential integer overflow issues in memory size calculations by:

  • Changing num_elements type from int32_t to int64_t
  • Adding overflow checks before size calculations
  • Using large_num_elements() instead of num_elements()
  • Casting final size to size_t after overflow validation

The changes affect BuddyMemoryManager and several kernel implementations (ExpandDims, If, Reshape, TransposeConv) to ensure safe memory operations with large tensors.

ONE-DCO-1.0-Signed-off-by: Chunseok Lee chunseok.lee@samsung.com

This commit addresses potential integer overflow issues in memory size calculations by:
- Changing num_elements type from int32_t to int64_t
- Adding overflow checks before size calculations
- Using large_num_elements() instead of num_elements()
- Casting final size to size_t after overflow validation

The changes affect BuddyMemoryManager and several kernel implementations (ExpandDims, If, Reshape, TransposeConv) to ensure safe memory operations with large tensors.

ONE-DCO-1.0-Signed-off-by: Chunseok Lee <chunseok.lee@samsung.com>
@mhs4670go
Copy link
Copy Markdown
Collaborator

@chunseoklee

Got format error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants