fix: avoid processing MOV (quicktime) files when BMFF is enabled

(cherry picked from commit 1b6895927f293855e5bb437ad28f31da2c2cfe54)
main
Christoph Hasse 4 years ago committed by mergify-bot
parent 9284b58bfc
commit 3e681c6730

@ -637,8 +637,16 @@ namespace Exiv2
return false; return false;
} }
bool matched = (buf[4] == 'f' && buf[5] == 't' && buf[6] == 'y' && buf[7] == 'p') // bmff should start with "ftyp"
||(buf[4] == 'J' && buf[5] == 'X' && buf[6] == 'L' && buf[7] == ' '); bool const is_ftyp = (buf[4] == 'f' && buf[5] == 't' && buf[6] == 'y' && buf[7] == 'p');
// jxl files have a special start indicator of "JXL "
bool const is_jxl = (buf[4] == 'J' && buf[5] == 'X' && buf[6] == 'L' && buf[7] == ' ');
// MOV(quicktime) files seem to also start with ftyp, but we don't want to process them
// so check that we don't encounter "qt "
// FIXME what others types can we abort early here?
bool const is_video = (buf[8] == 'q' && buf[9] == 't' && buf[10] == ' ' && buf[11] == ' ');
bool matched = is_jxl || (is_ftyp && !is_video);
if (!advance || !matched) { if (!advance || !matched) {
iIo.seek(static_cast<long>(0), BasicIo::beg); iIo.seek(static_cast<long>(0), BasicIo::beg);
} }
@ -654,4 +662,3 @@ namespace Exiv2
} }
} }
#endif #endif

Loading…
Cancel
Save