bevy-console icon indicating copy to clipboard operation
bevy-console copied to clipboard

Crash being registered with some bound checks missing

Open raffaeleragni opened this issue 1 year ago • 0 comments

log config:

let log_plugin = LogPlugin {
    level: log::Level::INFO,
    filter: "info,capture_bevy_logs=info".into(),
    custom_layer: bevy_console::make_layer,
};

command used:

use bevy::prelude::*;
use bevy_console::{AddConsoleCommand, ConsoleCommand};
use clap::Parser;

pub fn init(app: &mut App) {
    app.add_console_command::<Test, _>(test_command);
}

#[derive(Parser, ConsoleCommand)]
#[command(name = "test")]
struct Test {}

fn test_command(mut log: ConsoleCommand<Test>) {
    let Some(Ok(Test {})) = log.take() else {
        return;
    };
    error!("test");
}

thread 'Compute Task Pool (22)' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_console-0.12.1/src/console.rs:363:37: byte index 1516 is out of bounds of 2024-10-03T11:50:57.921184Z ERROR test stack backtrace: 0: rust_begin_unwind 1: core::panicking::panic_fmt 2: core::str::slice_error_fail_rt 3: core::str::slice_error_fail 4: core::ops::function::FnOnce::call_once{{vtable.shim}} 5: egui::ui::Ui::with_layout_dyn 6: core::ops::function::FnOnce::call_once{{vtable.shim}} 7: egui::containers::scroll_area::ScrollArea::show_viewport_dyn 8: core::ops::function::FnOnce::call_once{{vtable.shim}} 9: egui::ui::Ui::with_layout_dyn 10: core::ops::function::FnOnce::call_once{{vtable.shim}} 11: egui::containers::resize::Resize::show 12: core::ops::function::FnOnce::call_once{{vtable.shim}} 13: egui::ui::Ui::scope_dyn 14: egui::containers::collapsing_header::CollapsingState::show_body_unindented 15: egui::containers::window::Window::show_dyn 16: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut 17: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

raffaeleragni avatar Oct 03 '24 11:10 raffaeleragni