High
Security advisory
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2020-36317
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 1 Nov 2026, 08:46 UTC · Revision 1
Source evidence
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.
osv:CVE-2020-36317
Complete source record
{
"id": "c0a1eea6149d52abd1cc298dd97a5126d7ad8277d493bc6d7888e526ea3aeee7",
"url": "https://osv.dev/vulnerability/CVE-2020-36317",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2020-36317",
"summary": "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.",
"evidence": "osv:CVE-2020-36317",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2020-36317",
"aliases": [
"CVE-2020-36317"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/rust-lang/rust",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "e1884a8e3c3e813aada8254edfa120e85bf5ffca"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "1.49.0"
}
],
"source": "CPE_RANGE"
}
]
}
}
],
"versions": [
"1.0.0-beta",
"1.0.0-alpha.2",
"1.0.0-alpha",
"0.9",
"0.8",
"release-0.7",
"0.7",
"release-0.6",
"0.6",
"release-0.5",
"0.5",
"release-0.4",
"0.4",
"release-0.2",
"0.2",
"release-0.1",
"0.1"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2020-36317.json"
}
}
],
"modified": "2026-10-24T10:50:06.354257683Z",
"provider": "osv",
"references": [
"https://github.com/rust-lang/rust/issues/78498",
"https://github.com/rust-lang/rust/pull/78499"
],
"provider_metadata": {
"unresolved_ranges": [
{
"cpes": [
"cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*"
],
"vendor_product": "rust-lang:rust",
"extracted_events": [
{
"range": [
{
"fixed": "1.49.0"
}
],
"source": "CPE_RANGE"
}
]
}
]
}
},
"related_cves": [
{
"value": "CVE-2020-36317",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 441960,
"published_at": "2021-04-11T20:15:12.39+00:00"
}