diff options
author | Bastien Bouclet | 2017-08-18 09:32:24 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-09-21 13:06:18 +0200 |
commit | 8547c89b86f0be02c4b3ef8e8adb4d5f96cf8432 (patch) | |
tree | dbe3fe398731a85a2d33440888613d87317397d8 /common | |
parent | 9127f5245fe10bc9de8efea5a9050d980f3ef241 (diff) | |
download | scummvm-rg350-8547c89b86f0be02c4b3ef8e8adb4d5f96cf8432.tar.gz scummvm-rg350-8547c89b86f0be02c4b3ef8e8adb4d5f96cf8432.tar.bz2 scummvm-rg350-8547c89b86f0be02c4b3ef8e8adb4d5f96cf8432.zip |
VIDEO: Change QT edit list to a Common::Array
And fix an out of bounds acces when seeking to the end of a video.
Skipping samples is needed even when seeking through silent edits
because a silent stream is queued for those.
Fixes #10219.
Diffstat (limited to 'common')
-rw-r--r-- | common/quicktime.cpp | 16 | ||||
-rw-r--r-- | common/quicktime.h | 3 |
2 files changed, 7 insertions, 12 deletions
diff --git a/common/quicktime.cpp b/common/quicktime.cpp index 76880e1016..ecbf021e45 100644 --- a/common/quicktime.cpp +++ b/common/quicktime.cpp @@ -124,9 +124,8 @@ void QuickTimeParser::init() { // If this track doesn't have an edit list (like in MPEG-4 files), // fake an entry of one edit that takes up the entire sample - if (_tracks[i]->editCount == 0) { - _tracks[i]->editCount = 1; - _tracks[i]->editList = new EditListEntry[1]; + if (_tracks[i]->editList.size() == 0) { + _tracks[i]->editList.resize(1); _tracks[i]->editList[0].trackDuration = _tracks[i]->duration; _tracks[i]->editList[0].timeOffset = 0; _tracks[i]->editList[0].mediaTime = 0; @@ -434,14 +433,14 @@ int QuickTimeParser::readELST(Atom atom) { _fd->readByte(); // version _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - track->editCount = _fd->readUint32BE(); - track->editList = new EditListEntry[track->editCount]; + uint32 editCount = _fd->readUint32BE(); + track->editList.resize(editCount); - debug(2, "Track %d edit list count: %d", _tracks.size() - 1, track->editCount); + debug(2, "Track %d edit list count: %d", _tracks.size() - 1, editCount); uint32 offset = 0; - for (uint32 i = 0; i < track->editCount; i++) { + for (uint32 i = 0; i < editCount; i++) { track->editList[i].trackDuration = _fd->readUint32BE(); track->editList[i].mediaTime = _fd->readSint32BE(); track->editList[i].mediaRate = Rational(_fd->readUint32BE(), 0x10000); @@ -836,8 +835,6 @@ QuickTimeParser::Track::Track() { width = 0; height = 0; codecType = CODEC_TYPE_MOV_OTHER; - editCount = 0; - editList = 0; frameCount = 0; duration = 0; startTime = 0; @@ -850,7 +847,6 @@ QuickTimeParser::Track::~Track() { delete[] sampleToChunk; delete[] sampleSizes; delete[] keyframes; - delete[] editList; for (uint32 i = 0; i < sampleDescs.size(); i++) delete sampleDescs[i]; diff --git a/common/quicktime.h b/common/quicktime.h index f74d1ed0d9..3f82fc0431 100644 --- a/common/quicktime.h +++ b/common/quicktime.h @@ -150,8 +150,7 @@ protected: Array<SampleDesc *> sampleDescs; - uint32 editCount; - EditListEntry *editList; + Common::Array<EditListEntry> editList; uint32 frameCount; uint32 duration; |