Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Date: Mon, 04 Aug 2003 21:50:52 +0200
From: Holger Schemel Subject: [SDL] SDL_image PCX loader crashes (patch included) I've just discovered and fixed a problem with the current SDL_image 1.2.3 which can crash on every PCX file with an image width not being a multiple of 8 pixels if stored in bitplane format (with 4 or less bitplanes). In this case, the PCX loader happily writes beyond the allocated bitmap data buffer of the image surface in each line, which ends with a Segmentation Fault in the last line if you have bad luck and your allocated memory page ends near the last byte of the bitmap data. (In most cases you may have luck, which made this crash very difficult to track down in my case.) As this error is not fixed in the CVS yet, I've attached a patch to fix this bug (three lines in "IMG_pcx.c"). The fix prevents reading/writing the memory beyond the current line of the image being loaded. This was a particularly nasty error for me, because all my image files have a width which is a multiple of 8 or even 16/32, so the error never showed up, but some people creating custom artwork for my game Rocks'n'Diamonds created images less "perfect" ;-) and the game crashed on those image files only from time to time.
- Loading branch information