Advisory

RUSTSEC-2021-0032

Also known as: CVE-2021-28033, GHSA-8fgg-5v78-6g76

Summary

Deserializing an array can drop uninitialized memory on panic

Details

The read_bytes_default_le function for [T; n] arrays, used to deserialize
arrays of T from bytes created a [T; n] array with std::mem::uninitialized
and then called T's deserialization method.

If T's deserialization method panicked, the uninitialized memory could drop
invalid objects.

This flaw was corrected in a535678 by removing the unsafe block and using
a .map function to deserialize each element of the array instead.

Severity

Critical Basis: CVSS v3 score 9.8, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Dates

Published
2021-03-01 12:00 UTC
Modified
2023-11-08 04:05 UTC

Affected packages and fixes

byte_struct

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 0.6.1 (semver)

Fixed versions

0.6.1

Fix

  • Fixed version 0.6.1
    cargo update -p byte_struct --precise 0.6.1

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences