Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,10 @@ fn push_wtf8_codepoint(n: u32, scratch: &mut Vec<u8>) {

scratch.reserve(4);

// SAFETY: After the `reserve` call, `scratch` has at least 4 bytes of allocated but
// unintialized memory after its last initialized byte, which is where `ptr` points. All
// reachable match arms write `encoded_len` bytes to that region and update the length
// accordingly, and `encoded_len` is always <= 4.
unsafe {
let ptr = scratch.as_mut_ptr().add(scratch.len());

Expand Down