Bug #7063

Crashes by decoding

Added by Muzzy over 6 years ago. Updated over 6 years ago.

Status:ClosedStart date:2014-08-31
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


I was trying to decompile following file:

with command:
grfcodec.exe -d pb_trains_10CC.grf

Grfcodec version is 'trunk-r983'.

Following error occurred:
Found grf container version 2
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Associated revisions

Revision 984:a829c0cec2f3
Added by Rubidium over 6 years ago

Fix #7063: don't make infinite length sprite sheets as they can become too large to be buffered and cause a crash during decoding


#1 Updated by Rubidium over 6 years ago

The looks like a memory allocation issue where not enough contiguous space could be found to allocate memory for a larger buffer for PNG sprites. At peak the program uses about 1 GB for me, for a significant share caused by the huge sprite sheets (about 200 000 lines).

Use -h to limit the maximum size of the sprite sheets.

#2 Updated by Muzzy over 6 years ago

Thanks for explanation.
It would be nice to have a warning message telling that memory is not enough.

#3 Updated by Rubidium over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

Applied in changeset a829c0cec2f3.

Also available in: Atom PDF