Skip to content

transpose: Buffer overflow due to integer overflow

Critical severity GitHub Reviewed Published Apr 5, 2024 to the GitHub Advisory Database

Package

cargo transpose (Rust)

Affected versions

>= 0.1.0, < 0.2.3

Patched versions

0.2.3

Description

Given the function transpose::transpose:

fn transpose<T: Copy>(input: &[T], output: &mut [T], input_width: usize, input_height: usize)

The safety check input_width * input_height == output.len() can fail due to input_width * input_height overflowing in such a way that it equals output.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 and input_height arguments such that multiplying them overflows, and the overflown result equals the lengths of input and output slices.

References

Published to the GitHub Advisory Database Apr 5, 2024
Reviewed Apr 5, 2024

Severity

Critical
9.8
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

CVE ID

No known CVE

GHSA ID

GHSA-5gmm-6m36-r7jh

Source code

Checking history
See something to contribute? Suggest improvements for this vulnerability.