-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Deserialization fails when using bits = X
and read_all
alongside endian = "little"
#485
Labels
bug
Something isn't working
Comments
Good news, this seems to be fixed in #483.
use deku::prelude::*;
#[derive(Clone, Debug, DekuWrite, DekuRead)]
pub struct Foo {
#[deku(bits = 40)]
pub weird_sized_thing: u64,
pub normal_sized_thing: u8,
pub other_thing: u16,
#[deku(read_all)]
pub bulk_things: Vec<u8>,
}
fn main() {
env_logger::init();
#[rustfmt::skip]
const INPUT_DATA_MESSAGE: [u8; 11] = [
0x01, 0x01, 0x01, 0x01, 0x01,
0x0,
0x02, 0x02,
0x00, 0x00, 0x00,
];
let foo = Foo::try_from(INPUT_DATA_MESSAGE.as_ref()).unwrap();
println!("{:02x?}", foo);
}
I'll make sure this gets a unit test so it doesn't break again :) |
Merged
Should be closed with #483 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
I ran into a strange issue when trying to use
read_all
. When the struct also contains a specifically sized field using ex#[deku(bits = 40)]
, deserialization always fails withIncomplete(NeedSize { bits: 8 })
, but only when the endian-ness of the struct is explicitly specified. It seems to fail if set tobig
orlittle
.If I remove the endian specification, this program runs fine.
It also runs fine if I specify endian-ness but remove the
weird_sized_thing
struct member.I am using Deku 0.18.1 with Rust 1.72.0.
This issue does not appear to be present on Deku 0.17.
The text was updated successfully, but these errors were encountered: