aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2005-08-12 10:55:17 +0000
committerEugene Sandulenko2005-08-12 10:55:17 +0000
commitc4758fd5872362f805cd56e18341861b9f29e89b (patch)
treeab5e3007c606bb4fcf9a700aaa33b73934487552 /saga
parent31915362f1abcdbde2f13ebe51b6f9401afc17dc (diff)
downloadscummvm-rg350-c4758fd5872362f805cd56e18341861b9f29e89b.tar.gz
scummvm-rg350-c4758fd5872362f805cd56e18341861b9f29e89b.tar.bz2
scummvm-rg350-c4758fd5872362f805cd56e18341861b9f29e89b.zip
Fix bug #1257309 "ITE: Invalid read during startup"
svn-id: r18669
Diffstat (limited to 'saga')
-rw-r--r--saga/sprite.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index fb74d85967..253a3e504d 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -69,7 +69,7 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) {
uint16 newSpriteCount;
uint16 spriteCount;
int i;
- int outputLength;
+ int outputLength, inputLength;
uint32 offset;
const byte *spritePointer;
const byte *spriteDataPointer;
@@ -125,7 +125,8 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) {
}
spriteDataPointer = spritePointer + readS2.pos();
outputLength = spriteInfo->width * spriteInfo->height;
- decodeRLEBuffer(spriteDataPointer, 64000, outputLength); //todo: 64000 - should be replace by real input length
+ inputLength = spriteListLength - (spriteDataPointer - spriteListData);
+ decodeRLEBuffer(spriteDataPointer, inputLength, outputLength);
spriteInfo->decodedBuffer = (byte *) malloc(outputLength);
if (spriteInfo->decodedBuffer == NULL) {
memoryError("Sprite::loadList");