fast-float2 has a segmentation fault due to lack of bound check
Moderate severity
GitHub Reviewed
Published
Jan 29, 2025
to the GitHub Advisory Database
•
Updated Jan 29, 2025
Description
Published to the GitHub Advisory Database
Jan 29, 2025
Reviewed
Jan 29, 2025
Last updated
Jan 29, 2025
In this case, the "fast_float2::common::AsciiStr::first" method within the "AsciiStr" struct
uses the unsafe keyword to reading from memory without performing bounds checking.
Specifically, it directly dereferences a pointer offset by "self.ptr".
Because of the above reason, the method accesses invalid memory address when it takes an empty string as its input.
This approach violates Rust’s memory safety guarantees, as it can lead to invalid memory access if empty buffer is provided.
References