Crashes in gvariant related to bytes.len() - 1
Reproducer:
use zvariant::{EncodingContext as Context, from_slice, Value};
use byteorder::LE;
fn main() {
let ctx = Context::<LE>::new_gvariant(0);
let value: Result<Value, _> = from_slice(&vec![], ctx);
}
thread 'main' panicked at 'attempt to subtract with overflow', /home/jwestman/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-3.1.2/src/gvariant/de.rs:694:29
Some invalid inputs--particularly, an empty input--cause zvariant to panic rather than return an appropriate error. This case is an integer underflow at zvariant/src/gvariant/de.rs:702 when the length of the message is 0. There are several other instances of len() - 1
in the same file, and I suspect they are also susceptible to invalid inputs.