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
When using read_all or bytes_read with a Vec of empty structs and at least one byte to read, Deku will enter into an infinite loop.
Actual Behavior
The code compiles without issue and the program enters an infinite loop that can only be exited with an force quit.
Example:
use deku::prelude::*;#[derive(Debug,PartialEq,DekuRead)]structEmptyThing{}#[derive(Debug,PartialEq,DekuRead)]structListOfThings{// Either of the following lines cause an infinite loop.// #[deku(bytes_read="1")]#[deku(read_all)]things:Vec<EmptyThing>}fnmain(){let bytes:Vec<u8> = vec![0x00];let list_of_things_maybe = ListOfThings::from_bytes((bytes.as_ref(),0));if list_of_things_maybe.is_ok(){println!("Ok! {:?}", list_of_things_maybe.unwrap());}else{println!("Not Ok!");}}
Expected Behavior
The ideal solution would be to fail compilation because this is not a valid situation (i.e. you can't read a Vec nothings). It might also make sense to allow compilation and just read an empty Vec.
The text was updated successfully, but these errors were encountered:
When using
read_all
orbytes_read
with a Vec of empty structs and at least one byte to read, Deku will enter into an infinite loop.Actual Behavior
The code compiles without issue and the program enters an infinite loop that can only be exited with an force quit.
Example:
Expected Behavior
The ideal solution would be to fail compilation because this is not a valid situation (i.e. you can't read a Vec nothings). It might also make sense to allow compilation and just read an empty Vec.
The text was updated successfully, but these errors were encountered: