Skip to content

widen s_cost * p_cost to usize when sizing parallel memory#905

Open
dxbjavid wants to merge 1 commit into
RustCrypto:masterfrom
dxbjavid:balloon-parallel-memory-overflow
Open

widen s_cost * p_cost to usize when sizing parallel memory#905
dxbjavid wants to merge 1 commit into
RustCrypto:masterfrom
dxbjavid:balloon-parallel-memory-overflow

Conversation

@dxbjavid

@dxbjavid dxbjavid commented Jun 1, 2026

Copy link
Copy Markdown

With the parallel feature, hash_password_into and balloon_m size the per-thread memory as s_cost * p_cost evaluated in u32 and only then cast to usize. Both come from NonZeroU32 params and can be parsed from a hash string, so a product reaching 2^32 wraps: release builds get an undersized (often zero-length) buffer and a passing MemoryTooLittle check, debug builds panic on the multiply. Casting each operand to usize first computes the real size on 64-bit targets.

@dxbjavid

Copy link
Copy Markdown
Author

Hi team,

Just checking in on this PR. I wanted to see if there are any updates regarding the review or next steps.

Please let me know if any further changes are required from my side.

Thank you!

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.

1 participant