Skip to content

Commit 49665c9

Browse files
committed
Fix crashes with invalid utf-8.
According to the discussion in emacs bug#74922 it's possible that emacs passes invalid strings to dynamic libraries.
1 parent 126241a commit 49665c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/types/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl FromLisp<'_> for String {
1313
#[cfg(feature = "utf-8-validation")]
1414
fn from_lisp(value: Value<'_>) -> Result<Self> {
1515
let bytes = value.env.string_bytes(value)?;
16-
Ok(String::from_utf8(bytes).unwrap())
16+
String::from_utf8(bytes).map_err(|e| e.into())
1717
}
1818
}
1919

0 commit comments

Comments
 (0)