Apply stco/co64 bounds fix from PR #1333 to MP4 chapter code

The updateChunkOffsets() function in mp4qtchapterlist.cpp and
mp4chapterlist.cpp is duplicated code from mp4tag.cpp and needs
the patch from mp4tag.cpp too.
This commit is contained in:
Urs Fleisch
2026-04-18 19:46:55 +02:00
committed by Ryan Francesconi
parent ba2441b378
commit 0df52e3993
2 changed files with 8 additions and 4 deletions

View File

@@ -83,7 +83,8 @@ namespace
unsigned int count = data.toUInt();
file->seek(atom->offset() + 16);
unsigned int pos = 4;
while(count--) {
const unsigned int maxPos = data.size() - 4;
while(count-- && pos <= maxPos) {
auto o = static_cast<offset_t>(data.toUInt(pos));
if(o > offset)
o += delta;
@@ -101,7 +102,8 @@ namespace
unsigned int count = data.toUInt();
file->seek(atom->offset() + 16);
unsigned int pos = 4;
while(count--) {
const unsigned int maxPos = data.size() - 8;
while(count-- && pos <= maxPos) {
long long o = data.toLongLong(pos);
if(o > offset)
o += delta;

View File

@@ -95,7 +95,8 @@ namespace
unsigned int count = data.toUInt();
file->seek(atom->offset() + 16);
unsigned int pos = 4;
while(count--) {
const unsigned int maxPos = data.size() - 4;
while(count-- && pos <= maxPos) {
auto o = static_cast<offset_t>(data.toUInt(pos));
if(o > offset)
o += delta;
@@ -113,7 +114,8 @@ namespace
unsigned int count = data.toUInt();
file->seek(atom->offset() + 16);
unsigned int pos = 4;
while(count--) {
const unsigned int maxPos = data.size() - 8;
while(count-- && pos <= maxPos) {
long long o = data.toLongLong(pos);
if(o > offset)
o += delta;