SCI: Added a bounds check on the index when setting palette.

svn-id: r38407
This commit is contained in:
Walter van Niftrik 2009-02-17 14:13:42 +00:00
parent d39d83e525
commit 9ae02c978c

View File

@ -341,6 +341,12 @@ scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) {
static int
scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue) {
if (index < 0 || index > 255)
{
GFXERROR("Attempt to set invalid palette entry %d\n", index);
return GFX_ERROR;
}
byte color[] = {red, green, blue, 255};
g_system->setPalette(color, index, 1);
return GFX_OK;