Description
In the standard library in Rust before 1.49.0, String::retain() function has a panic safety problem. It allows creation of a non-UTF-8 Rust string when the provided closure panics. This bug could result in a memory safety violation when other string APIs assume that UTF-8 encoding is used on the same string.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | rustc | 1.53.0+dfsg1-1 | — |
| Debian 13 | rustc | 1.53.0+dfsg1-1 | — |
| Debian 12 | rustc | 1.53.0+dfsg1-1 | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 20.04 LTS | rustc | 1.51.0+dfsg1+llvm-1~exp3ubuntu1~20.04.2 | — |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 16.04 LTS | rustc | No fix yet | — |
| Ubuntu Pro 14.04 LTS | rustc | No fix yet | — |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 8 | rls +13 | 1.49.0-1.module+el8.4.0+9446+1a463e08 | RHSA-2021:1935 |
Show 1 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Red Hat Devtools 2021 | rust-toolset-1.49 +15 | 1.49.0-1.el7_9 | RHSA-2021:2243 |
Rocky Linux
Errata ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Rocky Linux 8 | rust +1 | 1.49.0-1.module+el8.4.0+416+259a129a | RLSA-2021:1935 |
Oracle Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Oracle Linux 8 | rls +13 | 1.49.0-1.module+el8.4.0+20083+9f8f961d | ELSA-2021-1935 |
Advisories 4
- RHSA-2021:2243 Red Hat Security Advisory: rust-toolset-1.49 and rust-toolset-1.49-rust update Red Hat Security Advisories (RHSA) · Jun 26, 2026
- RHSA-2021:1935 Red Hat Security Advisory: rust-toolset:rhel8 security, bug fix, and enhancement update Red Hat Security Advisories (RHSA) · Feb 26, 2026
- RLSA-2021:1935 Low: rust-toolset:rhel8 security, bug fix, and enhancement update Rocky Linux Security Advisories · Feb 4, 2026
- ELSA-2021-1935 Low: rust-toolset:ol8 security, bug fix, and enhancement update (Oracle Linux 8) Oracle Linux Security Advisories (ELSA) · May 25, 2021