Skip to content

Commit 8d3b890

Browse files
committed
Fix IoRead's raw buffering on invalid utf-8 as well
1 parent 054326e commit 8d3b890

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/read.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,10 @@ where
377377
V: Visitor<'de>,
378378
{
379379
let raw = self.raw_buffer.take().unwrap();
380-
let raw = String::from_utf8(raw).unwrap();
380+
let raw = match String::from_utf8(raw) {
381+
Ok(raw) => raw,
382+
Err(_) => return error(self, ErrorCode::InvalidUnicodeCodePoint),
383+
};
381384
visitor.visit_map(OwnedRawDeserializer {
382385
raw_value: Some(raw),
383386
})

0 commit comments

Comments
 (0)