Closed evanrichter closed 2 years ago
fuzzing found a multiplication overflow here:
https://github.com/jorgecarleitao/parquet2/blob/7caafa4ddc7c00dc81038736829e9e973611f956/src/schema/types/spec.rs#L44
so I changed it to a checked_mul and also realized the subtract 1 could underflow also. the fuzzer didn't confirm, but the rust compiler did:
checked_mul
error: this arithmetic operation will overflow --> src/main.rs:2:20 | 2 | println!("{}", (i32::MIN / 8) * 8 - 1); | ^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow
Thanks, @evanrichter 🙇
fuzzing found a multiplication overflow here:
https://github.com/jorgecarleitao/parquet2/blob/7caafa4ddc7c00dc81038736829e9e973611f956/src/schema/types/spec.rs#L44
so I changed it to a
checked_mul
and also realized the subtract 1 could underflow also. the fuzzer didn't confirm, but the rust compiler did: