Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error: index out of range [1] with length 1 #566

Closed
mavrick opened this issue Sep 22, 2024 · 4 comments · Fixed by #569
Closed

runtime error: index out of range [1] with length 1 #566

mavrick opened this issue Sep 22, 2024 · 4 comments · Fixed by #569

Comments

@mavrick
Copy link

mavrick commented Sep 22, 2024

Describe the bug

Starting!
{received GameEvent but event descriptors are missing 3}

Player hurt event without weapon occurred

Player hurt event without weapon occurred

{unknown event "cs_game_disconnected" 0}

{unknown event "grenade_bounce" 0}

{unknown event "warmup_end" 0}

runtime error: index out of range [1] with length 1
stacktrace:
goroutine 6 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x5e
github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs.NewParserWithConfig.func1({0x13f4300?, 0xc001a40d40})
        github.com/markus-wa/demoinfocs-golang/[email protected]/pkg/demoinfocs/parser.go:403 +0x2f
github.com/markus-wa/godispatch.(*Dispatcher).dispatchWithRecover.func1()
        github.com/markus-wa/[email protected]/dispatch.go:197 +0x3b
panic({0x13f4300?, 0xc001a40d40?})
        runtime/panic.go:914 +0x21f
github.com/markus-wa/godispatch.callConsumerCode.func1()
        github.com/markus-wa/[email protected]/dispatch.go:122 +0x54
panic({0x1452ce0?, 0xc001b10930?})
        runtime/panic.go:914 +0x21f
github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs.mapGameEventData(...)
        github.com/markus-wa/demoinfocs-golang/[email protected]/pkg/demoinfocs/game_events.go:1117
github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs.(*parser).handleGameEvent(0xc0002ccc40, 0xc00181b6b8)
        github.com/markus-wa/demoinfocs-golang/[email protected]/pkg/demoinfocs/game_events.go:65 +0x379
github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs.(*parser).handleGameEventS2(0xc0002ccc40, 0xc001573c20)
        github.com/markus-wa/demoinfocs-golang/[email protected]/pkg/demoinfocs/game_events.go:118 +0x385
reflect.Value.call({0x1389da0?, 0xc000054eb0?, 0xc0002dbb90?}, {0x14b4fc0, 0x4}, {0xc00181bef8, 0x1, 0x3?})   
        reflect/value.go:596 +0xce7
reflect.Value.Call({0x1389da0?, 0xc000054eb0?, 0x0?}, {0xc00181bef8?, 0x2900000000000000?, 0x3?})
        reflect/value.go:380 +0xb9
github.com/markus-wa/godispatch.callConsumerCode({0x1389da0?, 0xc000054eb0?, 0xc000058500?}, {0xc00181bef8?, 0xfe7306?, 0x0?})
        github.com/markus-wa/[email protected]/dispatch.go:125 +0x3f
github.com/markus-wa/godispatch.(*Dispatcher).Dispatch(0xc0000a8600, {0x14558e0, 0xc001573c20})
        github.com/markus-wa/[email protected]/dispatch.go:111 +0x1d4
github.com/markus-wa/godispatch.(*Dispatcher).dispatchWithRecover(0xc0000a8618?, {0x14558e0?, 0xc001573c20?}) 
        github.com/markus-wa/[email protected]/dispatch.go:202 +0x4f
github.com/markus-wa/godispatch.(*Dispatcher).dispatchQueue(0xc0000a8600, 0x0?)
        github.com/markus-wa/[email protected]/dispatch.go:177 +0xd0
created by github.com/markus-wa/godispatch.(*Dispatcher).AddQueues in goroutine 1
        github.com/markus-wa/[email protected]/dispatch.go:162 +0x18a

To Reproduce
parse demo: https://drive.google.com/file/d/13-jHqduYjMKKwudaheLJwXg-SjTj3FK0/view?usp=sharing

Library version
v4.3.0

Additional context
using node module: @akiver/cs-demo-analyzer

@akiver
Copy link
Collaborator

akiver commented Sep 22, 2024

Since this demo doesn't contain the game event list message it uses the list embedded with the lib.
The game event list schema changed since the network protocol v14023 so recent demos may not work.

Not sure how you want to deal with this problem @markus-wa ? Here is how I handle upgrades in my analyzer - if we update the bin file it will break older older demos compatibility.

@markus-wa
Copy link
Owner

Can we tell the network protocol from a demo? if so we should have a map of version->game event list.

@akiver
Copy link
Collaborator

akiver commented Sep 25, 2024

Can we tell the network protocol from a demo? if so we should have a map of version->game event list.

This information is inside the first proto message of a demo (CDemoFileHeader), I think we could update source2FallbackGameEventListBin when we got the message

@markus-wa
Copy link
Owner

sounds good to me 👍 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants