From 0b2e06e4a4225a6ede1be4e9f6c09fe2cd4caf16 Mon Sep 17 00:00:00 2001 From: Fabio Battaglia Date: Sat, 18 Apr 2009 08:37:22 +0000 Subject: sword2: add support for BS2 PSX demo svn-id: r39977 --- engines/sword2/sprite.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'engines/sword2/sprite.cpp') 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); -- cgit v1.2.3