ggtracker / ggtracker/sc2reader

Replay parsing failures

Open
#125 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
169
Forks
152
PR merge metrics
No merged PRs in 30d

Description

Trying to load replays at load_level=2 and sc2reader errors out with the following stack trace:

Traceback (most recent call last):
File "main.py", line 443, in
main(sys.argv[1:])
File "main.py", line 185, in main
replay_list = list(replays)
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/factories/sc2factory.py", line 146, in load_all
yield self._load(cls, resource, filename=filename, options=options)
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/factories/sc2factory.py", line 151, in _load
obj = cls(resource, filename=filename, factory=self, **options)
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/resources.py", line 301, in init
self._read_data(data_file, self._get_reader(data_file))
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/resources.py", line 893, in _read_data
self.raw_data[data_file] = reader(data, self)
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/readers.py", line 274, in call
for i in range(data.read_bits(5))
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/readers.py", line 274, in
for i in range(data.read_bits(5))
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/readers.py", line 197, in
for i in range(
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/decoders.py", line 210, in read_uint32
data = self._buffer.read_uint32()
File "/home/steve/workspace/trueskill/venv/lib/python3.7/site-packages/sc2reader/decoders.py", line 91, in read_uint32
return self._unpack_int(self.read(4))[0]
struct.error: unpack requires a buffer of 4 bytes

Script runs successfully when load_level=0

Here's the relevant output of sc2parse (only the errors):
pastebin

Here are archives of the offending replays:
sc2reader_replays_1.zip
sc2reader_replays_2.zip
sc2reader_replays_3.zip
sc2reader_replays_4.zip
sc2reader_replays_5.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the supplied replay archives at load_level=2, then inspect sc2reader/readers.py around line 274 and sc2reader/decoders.py around read_uint32. Compare the behavior with the sc2parse errors and confirm that all supplied offending replays can be loaded without the buffer-underflow error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.