MaxOhn / rosu-pp

PP and star calculation for all osu! gamemodes
MIT License
85 stars 40 forks source link

Catch convert panics at reserving ticks vector #13

Closed rorre closed 2 years ago

rorre commented 2 years ago

Attempting to calculate catch convert SR in Helix's Aleph-0 (Jack of all Trades diff) seems to lead to capacity overflow while trying to reserve ticks vector.

Stack trace ``` thread 'main' panicked at 'capacity overflow', library\alloc\src\raw_vec.rs:517:5 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\std\src\panicking.rs:584 1: core::panicking::panic_fmt at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:142 2: alloc::raw_vec::capacity_overflow at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\alloc\src\raw_vec.rs:517 3: alloc::raw_vec::handle_reserve at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:488 4: alloc::raw_vec::impl$1::reserve::do_reserve_and_handle,alloc::alloc::Global> at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:285 5: alloc::raw_vec::RawVec,alloc::alloc::Global>::reserve,alloc::alloc::Global> at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:289 6: alloc::vec::Vec,alloc::alloc::Global>::reserve,alloc::alloc::Global> at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\vec\mod.rs:815 7: enum$::new at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\fruit_or_juice.rs:98 8: rosu_pp::catch::calculate_movement::closure$0 at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:172 9: core::ops::function::impls::impl$3::call_mut >,rosu_pp::catch::calculate_movement::closure_env$0> at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:290 10: core::slice::iter::impl$173::find_map,ref_mut$ > at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\slice\iter\macros.rs:276 11: core::iter::adapters::filter_map::impl$2::next,core::slice::iter::Iter,rosu_pp::catch::calculate_movement::closure_env$0> at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\filter_map.rs:61 12: core::iter::adapters::fuse::impl$9::next,rosu_pp::catch::calculate_movement::closure_env$0> > at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\fuse.rs:364 13: core::iter::adapters::fuse::impl$2::next,rosu_pp::catch::calculate_movement::closure_env$0> > at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\fuse.rs:70 14: core::iter::adapters::flatten::impl$17::next,rosu_pp::catch::calculate_movement::closure_env$0>,enum$ > at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\flatten.rs:299 15: core::iter::adapters::flatten::impl$12::next,rosu_pp::catch::calculate_movement::closure_env$0>,enum$ > at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\flatten.rs:192 16: core::iter::adapters::take::impl$1::next,rosu_pp::catch::calculate_movement::closure_env$0> > > at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\take.rs:37 17: rosu_pp::catch::calculate_movement at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:207 18: rosu_pp::catch::CatchStars::calculate at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:100 19: enum$::calculate at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\stars.rs:107 20: osu_ipc_rust::osu::calculate_sr at .\src\osu.rs:19 ```

https://github.com/MaxOhn/rosu-pp/blob/d81a8c9ab65fdd98011a250ab9d64bba69be3165/src/catch/fruit_or_juice.rs#L84-L98

MaxOhn commented 2 years ago

Mh looks familiar, used to have a similar issue for osu!standard slider handling. I'll try to get to it soon, thanks for reporting.

MaxOhn commented 2 years ago

Fix released in 0.8.0 🎉