diff options
Diffstat (limited to 'engines/sword2/sprite.cpp')
-rw-r--r-- | engines/sword2/sprite.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp index 52ed0efbd0..2474293500 100644 --- a/engines/sword2/sprite.cpp +++ b/engines/sword2/sprite.cpp @@ -527,6 +527,10 @@ int32 Screen::drawSprite(SpriteInfo *s) { decompData = decompressHIF(s->data, tempBuf); + // Check that we correctly decompressed data + if(!decompData) + return RDERR_DECOMPRESSION; + s->w = (decompData / (s->h / 2)) * 2; byte *tempBuf2 = (byte *)malloc(s->w * s->h * 10); memset(tempBuf2, 0, s->w * s->h * 2); @@ -562,6 +566,11 @@ int32 Screen::drawSprite(SpriteInfo *s) { } else { byte *tempBuf = (byte *)malloc(s->w * s->h); uint32 decompData = decompressHIF(s->data, tempBuf); + + // Check that we correctly decompressed data + if(!decompData) + return RDERR_DECOMPRESSION; + s->w = (decompData / (s->h / 2)); sprite = (byte *)malloc(s->w * s->h); |