@ -334,6 +334,8 @@ namespace Exiv2 {
throw Error(kerCorruptedMetadata);
}
uint16_t dirLength = byteSwap2(dir,0,bSwap);
// Prevent infinite loops. (GHSA-m479-7frc-gqqg)
enforce(dirLength > 0, kerCorruptedMetadata);
if ( dirLength > 500 ) // tooBig
throw Error(kerTiffDirectoryTooLarge);