demoparser icon indicating copy to clipboard operation
demoparser copied to clipboard

Rust panic

Open osztenkurden opened this issue 1 year ago • 6 comments

Hey,

I'm getting error originating from Rust while parsing specific demo:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Literal { len: 28, src_len: 89138, dst_len: 0 }', demoparser\src\parser\src\parser.rs:72:93
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm doing only parseHeader(demoPath), all other demos I've tested work fine so far.

Demo link: https://drive.google.com/file/d/1bQ15cGalTWjIglCB2MCrVixK1IlBB5a_/view?usp=sharing

osztenkurden avatar Sep 05 '23 17:09 osztenkurden

hmm interesting was able to reproduce. Is there anything special about the demo? The error seems to be happening in an odd place.

LaihoE avatar Sep 05 '23 17:09 LaihoE

Anyway I've removed the panic and should now raise a proper error. Will be part of next release. I'm still curious tho on why that demo fails.

LaihoE avatar Sep 05 '23 18:09 LaihoE

From my side it looks like normal demo, so also not sure why it fails

osztenkurden avatar Sep 05 '23 20:09 osztenkurden

The demo runs fine in the official demo viewer so something seems to be wrong.

LaihoE avatar Sep 05 '23 21:09 LaihoE

After some investigation there seems to be a corrupt packet at tick 46095. Markus parser fails at the same tick. If I skip this tick the rest of the demo seems to work just fine. This leads us to a tricky question: What should be done in this situation? Should the parser raise an error or something else? A corrupt packet can have unexpected consequences later on in the demo... But in this situation It's almost certainly fine sooo...

LaihoE avatar Sep 06 '23 12:09 LaihoE

Perhaps custom event "error" or something, so after parsing it would be possible to check for "error" events, and decide what to do with the result?

osztenkurden avatar Sep 06 '23 12:09 osztenkurden