MitchellMarinoDev / carrier-pigeon

A rusty networking library for games.
Other
12 stars 2 forks source link

Sending malformed UDP packet crashes the server #4

Open elsid opened 2 years ago

elsid commented 2 years ago
thread 'main' panicked at 'slice index starts at 4 but ends at 1', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/carrier-pigeon-0.3.0/src/udp.rs:155:39
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: core::slice::index::slice_index_order_fail
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/slice/index.rs:51:5
   3: carrier_pigeon::udp::UdpCon::recv_shared
   4: carrier_pigeon::udp::UdpCon::recv_from
   5: carrier_pigeon::server::Server::recv_msgs
   6: <bevy_ecs::system::function_system::FunctionSystem<In,Out,Param,Marker,F> as bevy_ecs::system::system::System>::run_unsafe
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   9: async_task::raw::RawTask<F,T,S>::run
  10: async_executor::Executor::try_tick
  11: bevy_tasks::task_pool::TaskPool::scope
  12: <bevy_ecs::schedule::executor_parallel::ParallelExecutor as bevy_ecs::schedule::executor::ParallelSystemExecutor>::run_systems
  13: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
  14: bevy_ecs::schedule::Schedule::run_once
  15: <bevy_app::schedule_runner::ScheduleRunnerPlugin as bevy_app::plugin::Plugin>::build::{{closure}}
  16: bevy_app::app::App::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
MitchellMarinoDev commented 1 year ago

I forgot to add bounds checking there. Implemented now and will be in the next release.