Advisory

RUSTSEC-2024-0404

Also known as: GHSA-2rxc-gjrp-vjhx

Summary

Unsoundness in anstream

Details

When given a valid UTF8 string "ö\x1b😀", the function in
crates/anstream/src/adapter/strip.rs will be confused. The UTF8
bytes are \xc3\xb6 then \x1b then \xf0\x9f\x98\x80.

When looping over "non-printable bytes" \x1b\xf0 will be
considered as some non-printable sequence.

This will produce a broken str from the incorrectly segmented
bytes via str::from_utf8_unchecked, and that should never happen.

Full credit goes to @Ralith who reviewed this code and
asked @burakemir to follow up.

Severity

Not rated by the source.

Dates

Published
2024-09-08 12:00 UTC
Modified
2026-07-17 16:00 UTC

Affected packages and fixes

anstream

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 0.6.8 (semver)

Fixed versions

0.6.8

Fix

  • Fixed version 0.6.8
    cargo update -p anstream --precise 0.6.8

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