transpose: Buffer overflow due to integer overflow
Critical severity
GitHub Reviewed
Published
Apr 5, 2024
to the GitHub Advisory Database
Description
Published to the GitHub Advisory Database
Apr 5, 2024
Reviewed
Apr 5, 2024
Given the function
transpose::transpose
:The safety check
input_width * input_height == output.len()
can fail due toinput_width * input_height
overflowing in such a way that it equalsoutput.len()
.As a result of failing the safety check, memory past the end of
output
is written to. This only occurs in release mode since*
panics on overflow in debug mode.Exploiting this issue requires the caller to pass
input_width
andinput_height
arguments such that multiplying them overflows, and the overflown result equals the lengths of input and output slices.References