Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about NULL Pointer Dereference vulnerabilities in an interactive lesson.
Start learningUpgrade fast-float2
to version 0.2.2 or higher.
fast-float2 is a fast floating-point number parser.
Affected versions of this package are vulnerable to NULL Pointer Dereference via the AsciiStr::first
method within the AsciiStr
struct using the unsafe keyword to read from memory without performing bounds checking. An attacker can cause the application to crash or execute arbitrary code by providing an empty string as input.
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_read_write_u64() {
let bytes = b"01234567";
let string = AsciiStr::new(bytes);
let int = string.read_u64();
assert_eq!(int, 0x3736353433323130);
let int = bytes.read_u64();
assert_eq!(int, 0x3736353433323130);
let mut slc = [0u8; 8];
slc.write_u64(0x3736353433323130);
assert_eq!(&slc, bytes);
}
#[test]
fn test_first() {
let bytes = b"";
let string = AsciiStr::new(bytes);
let _int = string.first();
}
}