]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #78499 - SkiFire13:fix-string-retain, r=m-ou-se
authorJonas Schievink <jonasschievink@gmail.com>
Thu, 29 Oct 2020 16:05:28 +0000 (17:05 +0100)
committerGitHub <noreply@github.com>
Thu, 29 Oct 2020 16:05:28 +0000 (17:05 +0100)
commit48c4afbf9c29880dd946067d1c9aee1e7f75834a
tree4edb3ac88fd5324a1b070600afced7d02ac4134c
parenta01e5f8c0dcf27462f93a174b179c0595eab3e43
parent1f6f917f73a4372f098e9b19560b5945be145dc3
Rollup merge of #78499 - SkiFire13:fix-string-retain, r=m-ou-se

Prevent String::retain from creating non-utf8 strings when abusing panic

Fixes #78498

The idea is the same as `Vec::drain`, set the len to 0 so that nobody can observe the broken invariant if it escapes the function (in this case if `f` panics)