aserebryakov / sdl_doom

SDL port of the linuxxdoom-1.10

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game crash on starting a new game after player death

aserebryakov opened this issue · comments

Game crashes on a new game start after the player death.

Segmentation fault in Z_FreeTags() function.

There is a for-loop with the following start/end conditions:

block = mainzone->blocklist.next // start condition
block != &mainzone->blocklist // end condition

It looks like the end condition is always TRUE.

Possibly the issue is caused by the incorrect allocation.

The issue does not appear on the 320x200 version.

The issue does not appear if game is built using 320x200 screen resolution.

That can point on the memory corruption with increased resolution.

The fix provided in the commit 5eb9882.

The problem was caused by the following:
At ST_init() function there allocated buffer for status bar drawing with size 320x32. At function ST_refreshBackground() this buffer is written by V_DrawPatch(). As screen resolution was increased, allocated buffer was not big enough. That fact caused memory corruption.