Panic in zvariant: thread 'main' panicked at 'index out of bounds: the len is 10 but the index is 10'
Given this example program:
use std::error::Error;
use std::convert::TryInto;
use zbus::{dbus_interface, fdo};
struct Foo;
#[dbus_interface(name = "com.grahamc.Foo1")]
impl Foo {
fn bar(&self, name: &str, arg: &str) -> String {
format!("Hello {} {}!", name, arg)
}
}
fn main() -> Result<(), Box<dyn Error>> {
let connection = zbus::Connection::new_session()?;
fdo::DBusProxy::new(&connection)?.request_name(
"com.grahamc.Foo",
fdo::RequestNameFlags::ReplaceExisting.into(),
)?;
let mut object_server = zbus::ObjectServer::new(&connection);
object_server.at(&"/com/grahamc/Foo".try_into()?, Foo)?;
loop {
println!("hello");
if let Err(err) = object_server.try_handle_next() {
eprintln!("{}", err);
}
}
}
When I run call this method incorrectly:
[grahamc@Petunia:~]$ busctl --user call com.grahamc.Foo /com/grahamc/Foo com.grahamc.Foo1 Bar s "hello"
Call failed: Message recipient disconnected from message bus without replying
I get the following panic:
thread 'main' panicked at 'index out of bounds: the len is 10 but the index is 10', /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:210:28
stack backtrace:
0: 0x55d6a2030be2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbc432fcb96ef6975
1: 0x55d6a2053b7c - core::fmt::write::h8410abd894bca434
2: 0x55d6a203b907 - std::io::Write::write_fmt::h86de6a3429010a4b
3: 0x55d6a2036eb5 - std::panicking::default_hook::{{closure}}::h50ddb77147ffcd59
4: 0x55d6a2036b9f - std::panicking::default_hook::hf23e22c4e3e68213
5: 0x55d6a20374a8 - std::panicking::rust_panic_with_hook::h9bdeb7f9ba3511ec
6: 0x55d6a20370ab - rust_begin_unwind
7: 0x55d6a2053861 - core::panicking::panic_fmt::h8b4a8da40d3433a9
8: 0x55d6a2053822 - core::panicking::panic_bounds_check::h204330d3997c71cc
9: 0x55d6a1fc5591 - zvariant::de::Deserializer<B>::parse_padding::h0590889240adbe41
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:210
10: 0x55d6a1fda0da - <&mut zvariant::de::Deserializer<B> as serde::de::Deserializer>::deserialize_str::h192cd6a927b404dd
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:426
11: 0x55d6a1f9f957 - serde::de::impls::<impl serde::de::Deserialize for &str>::deserialize::h89d18078db0d1d34
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/impls.rs:459
12: 0x55d6a1f63de6 - <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize::ha98514e3c2de31b2
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/mod.rs:786
13: 0x55d6a1fc4326 - <zvariant::de::StructureDeserializer<B> as serde::de::SeqAccess>::next_element_seed::h0dc3fb7f751d7c84
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:770
14: 0x55d6a1fb4226 - serde::de::SeqAccess::next_element::hce0210ecb0bbb54a
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/mod.rs:1708
15: 0x55d6a1f9ab87 - <serde::de::impls::<impl serde::de::Deserialize for (T0,T1)>::deserialize::TupleVisitor<T0,T1> as serde::de::Visitor>::visit_seq::h58fa53b42ce7023c
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/impls.rs:1114
16: 0x55d6a1fd51d1 - <&mut zvariant::de::Deserializer<B> as serde::de::Deserializer>::deserialize_seq::h956e733ccc498063
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:570
17: 0x55d6a1fe07aa - <&mut zvariant::de::Deserializer<B> as serde::de::Deserializer>::deserialize_struct::h5048193d76bfb374
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:624
18: 0x55d6a1fe05ec - <&mut zvariant::de::Deserializer<B> as serde::de::Deserializer>::deserialize_tuple::h2ab0ad6948904c80
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:593
19: 0x55d6a1f9fa1c - serde::de::impls::<impl serde::de::Deserialize for (T0,T1)>::deserialize::hcf7355b87b655396
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/impls.rs:1124
20: 0x55d6a1fc7887 - zvariant::de::from_slice_fds_for_signature::h83b4f7aa691d57e1
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:160
21: 0x55d6a1fc4dea - zvariant::de::from_slice_fds::hd1f7cd6e6637d16b
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zvariant-2.0.0/src/de.rs:45
22: 0x55d6a1f7f4c0 - zbus::message::Message::body::ha558630beded85dd
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zbus-1.0.0/src/message.rs:443
23: 0x55d6a1f3a07b - <receive::Foo as zbus::object_server::Interface>::call::h0f3a8b9b3b1cd288
at src/receive.rs:7
24: 0x55d6a1fa406c - zbus::object_server::ObjectServer::dispatch_method_call_try::{{closure}}::{{closure}}::h0ca7b35560fcbddd
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zbus-1.0.0/src/object_server.rs:414
25: 0x55d6a1f57db3 - scoped_tls::ScopedKey<T>::set::hf3d3f09d652eeb6c
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
26: 0x55d6a1fa425a - zbus::object_server::ObjectServer::dispatch_method_call_try::{{closure}}::h9319fa64aeee2c7c
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zbus-1.0.0/src/object_server.rs:413
27: 0x55d6a1f57c88 - scoped_tls::ScopedKey<T>::set::hd1e16e60187a6505
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
28: 0x55d6a1fa37f7 - zbus::object_server::ObjectServer::dispatch_method_call_try::h06e1d6ee9f2785c9
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zbus-1.0.0/src/object_server.rs:412
29: 0x55d6a1fa42b3 - zbus::object_server::ObjectServer::dispatch_method_call::hdd12e96ab3e8db8b
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zbus-1.0.0/src/object_server.rs:424
30: 0x55d6a1fa46e6 - zbus::object_server::ObjectServer::dispatch_message::hb5c41a2780a3d2a5
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zbus-1.0.0/src/object_server.rs:452
31: 0x55d6a1fa4a04 - zbus::object_server::ObjectServer::try_handle_next::h054b196ed66a20bd
at /home/grahamc/.cargo/registry/src/github.com-1ecc6299db9ec823/zbus-1.0.0/src/object_server.rs:475
32: 0x55d6a1f39b55 - receive::main::hc40142b273f686b3
at src/receive.rs:25
33: 0x55d6a1f3831b - std::rt::lang_start::{{closure}}::h628aa229c4ac51c2
at /build/rustc-1.45.0-src/src/libstd/rt.rs:67
34: 0x55d6a2037795 - std::rt::lang_start_internal::h057182eff4078461
35: 0x55d6a1f382f7 - std::rt::lang_start::h63d99444eb1b5564
at /build/rustc-1.45.0-src/src/libstd/rt.rs:67
36: 0x55d6a1f3b4ba - main
37: 0x7f2ff6973c7d - __libc_start_main
38: 0x55d6a1f381ba - _start
at ../sysdeps/x86_64/start.S:120
39: 0x0 - <unknown>
I'm using Rust 1.45.0. My cargo.toml and cargo.lock are attached: