Skip to content

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

Merged
mhs4670go merged 5 commits into
Samsung:masterfrom
chunseoklee:bounty
Apr 21, 2026
Merged

fix: prevent integer overflow in memory size calculation for tensors#16481
mhs4670go merged 5 commits into
Samsung: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.

@mhs4670go
Copy link
Copy Markdown
Collaborator

@chunseoklee Build error T_T

@chunseoklee
Copy link
Copy Markdown
Contributor Author

@chunseoklee Build error T_T

it is very strange since it succeed on my local.

Copy link
Copy Markdown
Collaborator

@mhs4670go mhs4670go left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mhs4670go mhs4670go merged commit 95fba2d into Samsung:master Apr 21, 2026
13 checks passed
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