HistoryEditJSON (OSV)

CVE-2020-36317

String::retain allows safely creating invalid strings when abusing panic

Reported
Issued
Package
std
Type
Vulnerability
Categories
References
Patched
  • >=1.49.0
Unaffected
  • <1.26.0

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.

Advisory available under CC0-1.0 license.