Skip to content

Fix sparse set allocation size overflow - #23482

Open
crystarm wants to merge 1 commit into
php:masterfrom
crystarm:fix/ir-sparse-set-allocation-overflow
Open

Fix sparse set allocation size overflow#23482
crystarm wants to merge 1 commit into
php:masterfrom
crystarm:fix/ir-sparse-set-allocation-overflow

Conversation

@crystarm

Copy link
Copy Markdown
Contributor

Fixes an integer-overflow risk when calculating the allocation size for IR sparse sets.

Uses ir_mem_calloc(size, 2 * sizeof(*set->data)) so the allocator performs the checked multiplication, while preserving the existing sparse/dense memory layout.

The issue was detected by static analysis: BAD_ALLOC_ARITHMETIC ir_private.h:[500:14].log

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be fixed upstream: https://github.com/dstogov/ir

@crystarm

Copy link
Copy Markdown
Contributor Author

@LamentXU123
Thank you, done!! dstogov/ir#187

Should I close this PR?

@LamentXU123

Copy link
Copy Markdown
Member

If your PR is merged upstream. Then sync the commit to this PR :)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants