IMG_ReadXPMFromArray

Hello,

I’m not sure if this is the correct list, but I cannot find an
SDL_image mailing-list.

I believe there is a bug in IMG_ReadXPMFromArray() in IMG_xpm.c.
IMG_ReadXPMFromArray(char **xpm) calls load_xpm(xpm, NULL). However,
in load_xpm(), calls:
start = SDL_RWops(src);

But, src is NULL. This causes a segfault to occur.

I currently have to use SDL_image-1.2.4-16 which does not make this calls.

I have had this segfault occur in openSUSE 10.2 with
SDL_image-1.2.5-24. Both versions are supplied by openSUSE as rpms.

I see that in the SVN
(http://www.libsdl.org/cgi/viewvc.cgi/trunk/SDL_image/IMG_xpm.c?revision=2390&view=markup)
the SDL_RWops() has been replaced with SDL_RWtell(). Does anyone know
if SDL_RWtell() will segfault if a null pointer is passed to it?

I haven’t tried installing the SVN version, but I thought I would ask
around if anyone else experiences a segfault when loading an XPM image
from an array (not a file).

One final note, I’m using SDL 1.2.11-22 as provided by openSUSE for v10.2.

Thank you,

Alvin

Alvin Beach <alvinbeach gmail.com> writes:

Hello,

I’m not sure if this is the correct list, but I cannot find an
SDL_image mailing-list.

I believe there is a bug in IMG_ReadXPMFromArray() in IMG_xpm.c.
IMG_ReadXPMFromArray(char **xpm) calls load_xpm(xpm, NULL). However,
in load_xpm(), calls:
start = SDL_RWops(src);

But, src is NULL. This causes a segfault to occur.

I currently have to use SDL_image-1.2.4-16 which does not make this calls.

I have had this segfault occur in openSUSE 10.2 with
SDL_image-1.2.5-24. Both versions are supplied by openSUSE as rpms.

I see that in the SVN

(http://www.libsdl.org/cgi/viewvc.cgi/trunk/SDL_image/IMG_xpm.c?revision=2390&view=markup)

the SDL_RWops() has been replaced with SDL_RWtell(). Does anyone know
if SDL_RWtell() will segfault if a null pointer is passed to it?

I haven’t tried installing the SVN version, but I thought I would ask
around if anyone else experiences a segfault when loading an XPM image
from an array (not a file).

One final note, I’m using SDL 1.2.11-22 as provided by openSUSE for v10.2.

Thank you,

Alvin

Yes, I’ve been having this same problem, with the core dump pointing to that
statement as the cause. I’m seeing it in Debian 3.1 “Sarge” AMD64 platform (with
a self-built SDL and SDL_image, not one from apt). I tried the Subversion copy,
but it has the same problem, at the SDL_RWtell() line. Specifically, from my
core dump:

#0 load_xpm (xpm=0x50d360, src=0x0) at IMG_xpm.c:329
329 start = SDL_RWtell(src);