Skip to content

Conversation

w-utter
Copy link
Contributor

@w-utter w-utter commented Jul 21, 2025

Fragment size and the number of fragmentations are checked for integer overflow instead of casting them with as _. This will exponentiall increase the fragment size if the number of fragments cannot be fit inside a u32 (hence exponentially decreasing it) and default the fragment size to u16::MAX if it overflows.

(data_size / fragment_size) + u32::from(data_size % fragment_size != 0) has also been replaced with data_size.div_ceil(fragment_size) as it is functionally identical and has been stabilized since 1.73

@w-utter w-utter force-pushed the rpts-frag-check-overflow branch from b782965 to 57540c1 Compare July 21, 2025 13:31
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