Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing map deserialization when header name or value is not a valid UTF8 string #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions src/hostcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,8 +1188,8 @@ mod utils {
let value = bytes[p..p + size].to_vec();
p += size + 1;
map.push((
String::from_utf8(key).unwrap(),
String::from_utf8(value).unwrap(),
String::from_utf8(key).unwrap_or(String::from("?")),
String::from_utf8(value).unwrap_or(String::from("?")),
));
}
map
Expand All @@ -1211,7 +1211,7 @@ mod utils {
u32::from_le_bytes(<[u8; 4]>::try_from(&bytes[s + 4..s + 8]).unwrap()) as usize;
let value = bytes[p..p + size].to_vec();
p += size + 1;
map.push((String::from_utf8(key).unwrap(), value));
map.push((String::from_utf8(key).unwrap_or(String::from("?")), value));
}
map
}
Expand Down