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
let val = io.read(serial_port, id, $addr, size_of::<$reg_type>().try_into().unwrap())?;
let val = $reg_type::from_le_bytes(val.try_into().unwrap());
Basically if the received data from io.read are not the same size as the size of $reg_type the val.try_into().unwrap() will panic because val.try_into() will return an error which will then be unwrapped.
In my case I could only reproduce the case where the io.read returns and empty byte vector, I am not sure if other cases where the byte vector would be too small or too large can happen.
The text was updated successfully, but these errors were encountered:
Here is an example of the error happening: (support-poulpe branch but the same behavior can happen in any branch)
This is caused by these lines:
rustypot/src/device/mod.rs
Lines 20 to 21 in 72e7e8d
Basically if the received data from
io.read
are not the same size as the size of$reg_type
theval.try_into().unwrap()
will panic becauseval.try_into()
will return an error which will then be unwrapped.In my case I could only reproduce the case where the
io.read
returns and empty byte vector, I am not sure if other cases where the byte vector would be too small or too large can happen.The text was updated successfully, but these errors were encountered: