[Scummvm-git-logs] scummvm master -> 835f415e2b20a836221c396bd4bdaf152aca784a
Die4Ever
noreply at scummvm.org
Sun Sep 25 00:59:04 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
835f415e2b GROOVIE: Fix #2 possible crash with incorrect seeks to endpos in roq.cpp (#4257)
Commit: 835f415e2b20a836221c396bd4bdaf152aca784a
https://github.com/scummvm/scummvm/commit/835f415e2b20a836221c396bd4bdaf152aca784a
Author: lolovo (39863084+lolovo at users.noreply.github.com)
Date: 2022-09-24T19:59:01-05:00
Commit Message:
GROOVIE: Fix #2 possible crash with incorrect seeks to endpos in roq.cpp (#4257)
* GROOVIE: Fix #2 possible crash with incorrect seeks to endpos in roq.cpp
Fix bug - https://bugs.scummvm.org/ticket/13809
* Optimization
* Next optimization & maintan appropriate debug log
* GROOVIE: Check end of stream before seek to avoid crash in roq.cpp
* GROOVIE: resolve %ld conflict
Co-authored-by: Die4Ever <30947252+Die4Ever at users.noreply.github.com>
Changed paths:
engines/groovie/video/roq.cpp
diff --git a/engines/groovie/video/roq.cpp b/engines/groovie/video/roq.cpp
index 01b4589c205..be5bfcf88a4 100644
--- a/engines/groovie/video/roq.cpp
+++ b/engines/groovie/video/roq.cpp
@@ -544,7 +544,7 @@ bool ROQPlayer::processBlock() {
_file->skip(blockHeader.size);
}
- if (endpos != _file->pos()) {
+ if (endpos != _file->pos() && !_file->eos()) {
warning("Groovie::ROQ: BLOCK %04x Should have ended at %ld, and has ended at %d", blockHeader.type, endpos, (int)_file->pos());
warning("Ensure you've copied the files correctly according to the wiki.");
_file->seek(MIN(_file->pos(), endpos));
@@ -674,7 +674,7 @@ bool ROQPlayer::processBlockQuadVector(ROQBlockHeader &blockHeader) {
_motionOffY = blockHeader.param & 0xFF;
// Calculate where the block should end
- int32 endpos =_file->pos() + blockHeader.size;
+ int64 endpos =_file->pos() + blockHeader.size;
// Reset the coding types
_codingTypeCount = 0;
@@ -692,8 +692,11 @@ bool ROQPlayer::processBlockQuadVector(ROQBlockHeader &blockHeader) {
}
// HACK: Skip the remaining bytes
- int32 skipBytes = endpos -_file->pos();
+ int64 skipBytes = endpos -_file->pos();
if (skipBytes > 0) {
+ if (_file->eos()) {
+ return false;
+ }
_file->skip(skipBytes);
if (skipBytes != 2) {
warning("Groovie::ROQ: Skipped %d bytes", skipBytes);
More information about the Scummvm-git-logs
mailing list