pythcoiner / modbus485_debugger

Tool to sniff modbus serial lines
1 stars 0 forks source link

frame length check #5

Open pythcoiner opened 7 months ago

pythcoiner commented 7 months ago

in gui.rs::data_to_str() (line 552) if the frame length is short (invalid?) it makes modbus_core panic

pythcoiner commented 7 months ago

hit same issue here:

thread 'tokio-runtime-worker' panicked at /home/pyth/.cargo/git/checkouts/modbus-core-e1be9b742a59dda4/a88a86b/src/codec/mod.rs:160:23:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_bounds_check
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:208:5
   3: modbus_core::codec::<impl core::convert::TryFrom<&[u8]> for modbus_core::frame::Response>::try_from
   4: <lib::devices::vfd::encoder::VfdEncoder as lib::traits::device_encoder::DeviceEncoder<lib::devices::vfd::requests::VfdRequest,lib::devices::vfd::requests::VfdResponse>>::serial_to_response
   5: lib::batch::Batch<DeviceRequest,DeviceResponse>::handle_response
   6: lib::poller::ModbusPoller<DeviceRequest,DeviceResponse>::start::{{closure}}
   7: tokio::runtime::task::core::Core<T,S>::poll
   8: tokio::runtime::task::harness::Harness<T,S>::poll
   9: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  10: tokio::runtime::scheduler::multi_thread::worker::Context::run
  11: tokio::runtime::context::set_scheduler
  12: tokio::runtime::context::runtime::enter_runtime
  13: tokio::runtime::scheduler::multi_thread::worker::run
  14: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
  15: tokio::runtime::task::core::Core<T,S>::poll
  16: tokio::runtime::task::harness::Harness<T,S>::poll
  17: tokio::runtime::blocking::pool::Inner::run