Skip to content

fix: reject oversized FFI allocations#2781

Open
Sieger9303 wants to merge 1 commit into
pen-lang:mainfrom
Sieger9303:fix-ffi-oversized-allocations
Open

fix: reject oversized FFI allocations#2781
Sieger9303 wants to merge 1 commit into
pen-lang:mainfrom
Sieger9303:fix-ffi-oversized-allocations

Conversation

@Sieger9303

Copy link
Copy Markdown

Fixes #2710.

Hi, thanks for maintaining this project.

ArcBuffer::new and cps::Stack::new are public constructors that currently pass user-provided lengths/capacities into raw allocation paths. Extremely large values can lead to allocator aborts, sanitizer failures, or resource exhaustion before the APIs fail in a predictable Rust-side way.

This PR adds lightweight bounds checks directly in both constructors. The public API shape is unchanged; oversized inputs now fail with a clear Rust panic instead of reaching a huge raw allocation request.

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.

Potential huge allocations with untrusted len/capacity in ArcBuffer::new and cps::Stack::new

1 participant