Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Radix Integer Formatter Incorrectly Uses Uninitialized Memory #126

Closed
Alexhuszagh opened this issue Sep 13, 2024 · 1 comment · Fixed by #127
Closed

[BUG] Radix Integer Formatter Incorrectly Uses Uninitialized Memory #126

Alexhuszagh opened this issue Sep 13, 2024 · 1 comment · Fixed by #127
Assignees
Labels
A-sec Issues with potential security implications. bug Something isn't working high priority High priority

Comments

@Alexhuszagh
Copy link
Owner

Description

When using MaybeUninit::uninit, the radix writer converts this then to a &mut [u8], which is fine as long as the memory is read, however, all assignments are done via read/writes and not pointer writes. Since these formatters require copying to a temporary buffer anyway, it's very unlikely the use of a zero-initialized vs. a maybe unitialized buffer will cause major performance enhancements.

let mut digits: mem::MaybeUninit<[u8; 64]> = mem::MaybeUninit::uninit();

unsafe { index_unchecked_mut!($bytes[$index] = $table[$r + 1]) };

@Alexhuszagh Alexhuszagh added bug Something isn't working A-sec Issues with potential security implications. labels Sep 13, 2024
@Alexhuszagh Alexhuszagh self-assigned this Sep 13, 2024
@Alexhuszagh
Copy link
Owner Author

Related to #95.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sec Issues with potential security implications. bug Something isn't working high priority High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant