aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWalter van Niftrik2009-02-17 14:13:42 +0000
committerWalter van Niftrik2009-02-17 14:13:42 +0000
commit9ae02c978c9131b5448293a7ee791025bfc3f202 (patch)
treed961875e4dc602400d3bae001f11fae0098c7c73 /engines
parentd39d83e525d4a62e5b73727c65c7864d0adf2865 (diff)
downloadscummvm-rg350-9ae02c978c9131b5448293a7ee791025bfc3f202.tar.gz
scummvm-rg350-9ae02c978c9131b5448293a7ee791025bfc3f202.tar.bz2
scummvm-rg350-9ae02c978c9131b5448293a7ee791025bfc3f202.zip
SCI: Added a bounds check on the index when setting palette.
svn-id: r38407
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/gfx/gfx_driver.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index e96caa19e8..e5efd9d586 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -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;