aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2008-12-19 21:55:18 +0000
committerFilippos Karapetis2008-12-19 21:55:18 +0000
commita6e4bd793f7b2d236b703d98614adf49e43cf6f9 (patch)
tree4772abbeb7aa03059958b15296ba179258e6eaee
parenta4e08d94fce35313a1e71c0ab6d7a2687939aca2 (diff)
downloadscummvm-rg350-a6e4bd793f7b2d236b703d98614adf49e43cf6f9.tar.gz
scummvm-rg350-a6e4bd793f7b2d236b703d98614adf49e43cf6f9.tar.bz2
scummvm-rg350-a6e4bd793f7b2d236b703d98614adf49e43cf6f9.zip
Hopefully fixed invalid buffer reads
svn-id: r35446
-rw-r--r--graphics/smk_player.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/graphics/smk_player.cpp b/graphics/smk_player.cpp
index 983e001049..ea4fd45287 100644
--- a/graphics/smk_player.cpp
+++ b/graphics/smk_player.cpp
@@ -762,7 +762,7 @@ void SMKPlayer::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
int numBytes = 1 * (isStereo ? 2 : 1) * (is16Bits ? 2 : 1);
- byte *unpackedBuffer = new byte[unpackedSize + numBytes];
+ byte *unpackedBuffer = new byte[unpackedSize];
byte *curPointer = unpackedBuffer;
uint32 curPos = 0;
@@ -783,7 +783,7 @@ void SMKPlayer::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
// The bases are the first samples, too
- for (int i = 0; i < (isStereo ? 2 : 1); i++, curPointer += (is16Bits ? 2 : 1)) {
+ for (int i = 0; i < (isStereo ? 2 : 1); i++, curPointer += (is16Bits ? 2 : 1), curPos += (is16Bits ? 2 : 1)) {
if (is16Bits)
WRITE_BE_UINT16(curPointer, bases[i]);
else
@@ -822,7 +822,7 @@ void SMKPlayer::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
for (int k = 0; k < numBytes; k++)
delete audioTrees[k];
- _audioStream->queueBuffer(unpackedBuffer, unpackedSize + numBytes);
+ _audioStream->queueBuffer(unpackedBuffer, unpackedSize);
// unpackedBuffer will be deleted by AppendableAudioStream
}