We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1923 - Crash with SDL_SetColorKey
Summary: Crash with SDL_SetColorKey
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-20 12:34 UTC by Sylvain
Modified: 2013-07-06 23:30 UTC (History)
0 users

See Also:


Attachments
small program that crashes (21.62 KB, text/x-csrc)
2013-06-21 02:32 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2013-06-20 12:34:10 UTC
I have a crash with latest SDL 2.0 trunk (2013/06/21).

1/ Load an Image XPM with IMG_ReadXPMFromArray()
2/ Try to set a ColorKey on it.

I notice that : 
- the SDL_Surface that is created from XPM has a palette !
- the colorkey is a RBG.

it crashes (SIGSEGV) inside the SDL_SetColorKey function:
"surface->format->palette->colors[surface->map->info.colorkey].a"
Comment 1 Sam Lantinga 2013-06-20 23:48:09 UTC
Thanks for the report.  Can you attach a small program that crashes?
Comment 2 Sylvain 2013-06-21 02:32:38 UTC
Created attachment 1193 [details]
small program that crashes

Here's a small program that crashes, needs SDL2 + SDL2_image

It crashes because I try to set as a colorkey, a RGB color which gets out of the bounds of the palette of the image.
Comment 3 Sam Lantinga 2013-07-06 23:30:16 UTC
Nice catch, thanks!
http://hg.libsdl.org/SDL/rev/75b8a207cb65