Index: exempi-2.2.2/source/XMPFiles/FormatSupport/PSIR_FileWriter.cpp =================================================================== --- exempi-2.2.2/source/XMPFiles/FormatSupport/PSIR_FileWriter.cpp +++ exempi-2.2.2/source/XMPFiles/FormatSupport/PSIR_FileWriter.cpp 2018-03-19 09:39:29.606813923 +0100 @@ -291,6 +291,12 @@ ioBuf.ptr += paddedLen; // Move to the data length. XMP_Uns32 dataLen = GetUns32BE(ioBuf.ptr); XMP_Uns32 dataTotal = ((dataLen + 1) & 0xFFFFFFFEUL); // Round up to an even total. + // See bug https://bugs.freedesktop.org/show_bug.cgi?id=105204 + // If dataLen is 0xffffffff, then dataTotal might be 0 + // and therefor make the CheckFileSpace test pass. + if (dataTotal < dataLen) { + break; + } ioBuf.ptr += 4; // Advance to the resource data. XMP_Int64 thisDataPos = ioBuf.filePos + (ioBuf.ptr - ioBuf.data);