aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
authorPeter Kohaut2019-03-17 20:25:37 +0100
committerPeter Kohaut2019-03-17 22:01:16 +0100
commitbba7ab786bd47d259dac5254c03b1b0f56a7e890 (patch)
tree848cd5363caf8aff823dec5a1e8b41084cb98008 /engines/bladerunner
parent7e472de5a8b09082d017b860efe2644836251441 (diff)
downloadscummvm-rg350-bba7ab786bd47d259dac5254c03b1b0f56a7e890.tar.gz
scummvm-rg350-bba7ab786bd47d259dac5254c03b1b0f56a7e890.tar.bz2
scummvm-rg350-bba7ab786bd47d259dac5254c03b1b0f56a7e890.zip
BLADERUNNER: Fixed integer underflow for Russian videos
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/vqa_decoder.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp
index 38d3fd4744..ddd6c98abd 100644
--- a/engines/bladerunner/vqa_decoder.cpp
+++ b/engines/bladerunner/vqa_decoder.cpp
@@ -347,10 +347,12 @@ bool VQADecoder::readVQHD(Common::SeekableReadStream *s, uint32 size) {
bool VQADecoder::VQAVideoTrack::readVQFR(Common::SeekableReadStream *s, uint32 size, uint readFlags) {
IFFChunkHeader chd;
- while (size >= 8) {
+ signed int sizeLeft = size; // we have to use signed int to avoid underflow
+
+ while (sizeLeft >= 8) {
if (!readIFFChunkHeader(s, &chd))
return false;
- size -= roundup(chd.size) + 8;
+ sizeLeft -= roundup(chd.size) + 8;
bool rc = false;
switch (chd.id) {
@@ -663,10 +665,12 @@ void VQADecoder::VQAVideoTrack::decodeVideoFrame(Graphics::Surface *surface, boo
bool VQADecoder::VQAVideoTrack::readVQFL(Common::SeekableReadStream *s, uint32 size, uint readFlags) {
IFFChunkHeader chd;
- while (size >= 8) {
+ signed int sizeLeft = size; // we have to use signed int to avoid underflow
+
+ while (sizeLeft >= 8) {
if (!readIFFChunkHeader(s, &chd))
return false;
- size -= roundup(chd.size) + 8;
+ sizeLeft -= roundup(chd.size) + 8;
bool rc = false;
switch (chd.id) {