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

Some replays causing a Go runtime crash (working in SC) #29

Open
msikma opened this issue Feb 4, 2022 · 1 comment
Open

Some replays causing a Go runtime crash (working in SC) #29

msikma opened this issue Feb 4, 2022 · 1 comment

Comments

@msikma
Copy link

msikma commented Feb 4, 2022

Today I was stress testing some of my own code that uses screp's JSON output on a big pack of replays. By doing so I found a couple of replays that screp is unable to parse. Most of these were broken in Starcraft as well, but I found a couple (19) that work just fine in-game but cause a Go runtime error when parsing with screp:

2022/02/04 22:55:10 Parsing error: runtime error: slice bounds out of range [:262319] with capacity 262318
2022/02/04 22:55:10 Stack: goroutine 1 [running]:
github.com/icza/screp/repparser.parseProtected.func1()
	/Users/msikma/Source/screp/repparser/repparser.go:143 +0x8d
panic({0x10f09e0, 0xc00013e270})
	/usr/local/Cellar/go/1.17/libexec/src/runtime/panic.go:1038 +0x215
github.com/icza/screp/repparser.(*sliceReader).getString(...)
	/Users/msikma/Source/screp/repparser/slicereader.go:36
github.com/icza/screp/repparser.parseMapData({0xc0002d6000, 0x400ae, 0x279}, 0xc0000b8080, {0x1e, 0x0, 0x0, {}})
	/Users/msikma/Source/screp/repparser/repparser.go:716 +0xfa5
github.com/icza/screp/repparser.parse({0x11229b8, 0xc0000bc1c0}, {0x0, 0x0, 0x0, {}})
	/Users/msikma/Source/screp/repparser/repparser.go:238 +0x1a6
github.com/icza/screp/repparser.parseProtected({0x11229b8, 0xc0000bc1c0}, {0x44, 0x40, 0xb, {}})
	/Users/msikma/Source/screp/repparser/repparser.go:149 +0x72
github.com/icza/screp/repparser.ParseFileConfig({0x7ffeefbff19e, 0xc0000b8010}, {0xe0, 0x4c, 0x1b, {}})
	/Users/msikma/Source/screp/repparser/repparser.go:110 +0xc8
github.com/icza/screp/repparser.ParseFile(...)
	/Users/msikma/Source/screp/repparser/repparser.go:91
main.main()
	/Users/msikma/Source/screp/cmd/screp/screp.go:56 +0xed
Failed to parse replay: parsing

Here's the version I'm on, which seems to be the latest:

screp version: v1.5.1
Parser version: v1.7.0
EAPM algorithm version: v1.0.4
Platform: darwin amd64
Built with: go1.17
Author: Andras Belicza
Home page: https://github.com/icza/screp

And Go, which is admittedly probably not the latest.

go version go1.17.5 darwin/amd64

Here are the files. These replays are from an autoreplay pack of 2011-2013 posted by Scan at some point.

I did not open all of them in-game, but at least they all fail to parse by screp (and all with the same error that I pasted above) and the couple that I tested seem to play back just fine in Starcraft and don't even seem to desync. At the very least they all show a valid list of players+duration on the replay screen.

Note that by far most files from this replay pack work just fine, it's just this small number that fails.

@icza
Copy link
Owner

icza commented Feb 5, 2022

I know my parser is not perfect, and cannot handle all replays. It doesn't crash your runtime though, parsing replays is protected, it will only return an error.

Will look into it and try to fix this. Thanks for the report.

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

No branches or pull requests

2 participants