[Bug]: japanese UTF-8 strings deserialization error
glebpom opened this issue · comments
Gleb Pomykalov commented
Is there an existing issue for this?
- I have searched the existing issues
Code of Conduct
- I agree to follow this project's Code of Conduct
Current Behaviour
Long Japanese strings (>4095 bytes) can be normally serialized but deserialization fails with error. Alternative implementations deserializae correctly.
Expected Behaviour
Deserialization should succeed
Environment Information
Darwin Gleb-Pomykalov's-Macbook-Pro 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 arm64
fish: Unknown command: enarx
fish:
uname -a; enarx --version; enarx platform info
^
fish: Unknown command: enarx
fish:
uname -a; enarx --version; enarx platform info
Steps To Reproduce
MRE:
let mut s = String::new();
while s.len() < 4095 {
s.push_str("ボ");
}
println!("len = {}", s.len());
let val = json!({
"title": s,
});
let mut v = Vec::new();
ciborium::ser::into_writer(&val, &mut v).unwrap();
let _res: serde_json::Value = serde_cbor::from_reader(Cursor::new(&v)).unwrap();
let _res: serde_json::Value = ciborium::de::from_reader(Cursor::new(&v)).unwrap();
s.push_str("ボ");
println!("len = {}", s.len());
let val = json!({
"title": s,
});
let mut v = Vec::new();
ciborium::ser::into_writer(&val, &mut v).unwrap();
let _res: serde_json::Value = serde_cbor::from_reader(Cursor::new(&v)).unwrap();
let _res: serde_json::Value = ciborium::de::from_reader(Cursor::new(&v)).unwrap();
Gleb Pomykalov commented
Fix PR: #73
Gleb Pomykalov commented
Sorry for bothering you, but could you take a look at this? It seems like a critical bug, which requires a new release. Thanks.
Nuutti Kotivuori commented
Fixed in 0.2.1 and should be closed?