You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like a number of methods, including at the very least UnsafeReader::unwire_u64, perform unsound unaligned reads which will cause the program to crash with assertions enabled. Additionally, structs which derive Wiring and Unwiring but have unused padding inside or outside the struct use mem::size_of::<T>() to calculate the encoded size of multiple values in <Vec<T> as Unwiring>::bytes_length, even though the actual byte size may be much shorter.
Here are a couple tests demonstrating the issues I found:
use wiring::prelude::*;#[derive(Debug,PartialEq,Unwiring,Wiring)]structSyncopated{small:u8,big:u64,}#[derive(Debug,PartialEq,Unwiring,Wiring)]structSeveral{vec:Vec<Syncopated>,}#[test]fnunaligned_read(){let a = Syncopated{small:1,big:2};letmut buf = Vec::new();BufWire::new(&mut buf).wire(&a).unwrap();let b = BufUnWire::new(buf.as_slice()).unwire::<Syncopated>().unwrap();assert_eq!(a, b);}#[test]fnincorrect_size_estimation(){let a = Several{vec:vec![Syncopated{ small:1, big:2},Syncopated{ small:3, big:4}],};letmut buf = Vec::new();BufWire::new(&mut buf).wire(&a).unwrap();let b = BufUnWire::new(buf.as_slice()).unwire::<Several>().unwrap();assert_eq!(a, b);}
The text was updated successfully, but these errors were encountered:
mumbleskates
added a commit
to mumbleskates/rust_serialization_benchmark
that referenced
this issue
Jan 3, 2025
* fix arithmetic overflow panic
* use vec instead of a boxed array to avoid blowing the stack in dev mode
* make it possible to disable compression to speed up `cargo test --benches`
* disable wiring: louaykamel/wiring#3
* add test step to build.yml
* also run build step in the master branch (& give it a workflow_dispatch button)
* organize & alphabetize deps; organize & alphabetize features; make compression a positive feature
It looks like a number of methods, including at the very least
UnsafeReader::unwire_u64
, perform unsound unaligned reads which will cause the program to crash with assertions enabled. Additionally, structs which deriveWiring
andUnwiring
but have unused padding inside or outside the struct usemem::size_of::<T>()
to calculate the encoded size of multiple values in<Vec<T> as Unwiring>::bytes_length
, even though the actual byte size may be much shorter.Here are a couple tests demonstrating the issues I found:
The text was updated successfully, but these errors were encountered: