Email me

Rust advisories / ruint

VulnerabilityRUSTSEC-2026-0220 · ruint

RUSTSEC-2026-0220: Uint shift operations: incorrect overflow flags and truncated shift amounts

Short answerA security vulnerability in the ruint crate: Uint shift operations: incorrect overflow flags and truncated shift amounts. No severity score was published. Fixed in 1.20.0: update to a fixed version.

Crateruint
TypeVulnerability (denial-of-service)
Affected versionsBefore 1.20.0.
Fixed in1.20.0
Severitynot scored
Published2026-07-08
Last changed2026-07-30
Also known asnone
Affected functionsruint::Uint::checked_shl, ruint::Uint::checked_shr, ruint::Uint::overflowing_shl, ruint::Uint::overflowing_shr, ruint::Uint::saturating_shl, ruint::Uint::saturating_shr, ruint::Uint::wrapping_shl, ruint::Uint::wrapping_shr

What to do

  1. See which version you have: cargo tree -i ruint (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p ruint. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example ruint = "1.20.0") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

Uint::overflowing_shl/overflowing_shr returned false-negative overflow flags. overflowing_shl missed bits shifted above BITS but within the top limb (non-limb-aligned widths such as U160), and limbs wholly discarded by shifts >= 64; overflowing_shr missed wholly discarded low limbs. Shifted values were correct; only the flag was wrong.

The wrong flag propagates: checked_shl/checked_shr return Some instead of None, strict_* fail to panic, and saturating_* return a wrapped value instead of saturating. The incorrect checked_shl result causes to_base_be (and string formatting) to loop forever on no-alloc builds for non-limb-aligned widths , a denial of service if formatting is reachable from untrusted input.

Separately, wrapping_shl/wrapping_shr on 64/128/256-bit types truncated the shift amount modulo 2^32, so shifts >= 2^32 returned an incorrectly wrapped value instead of zero; on 32-bit targets the generic path also truncated 64-bit shift amounts.

Callers using checked or saturating shift semantics on untrusted shift amounts may compute incorrect results.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for ruint

Full security history of ruint

Up next

Same crateruint: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ