diff --git a/src/pngchunk_int.cpp b/src/pngchunk_int.cpp index 64a370e5..714b95b4 100644 --- a/src/pngchunk_int.cpp +++ b/src/pngchunk_int.cpp @@ -668,8 +668,7 @@ namespace Exiv2 { } long length = (long) atol(startOfLength); - enforce(length >= 0, Exiv2::kerCorruptedMetadata); - enforce(length <= (eot - sp)/2, Exiv2::kerCorruptedMetadata); + enforce(0 <= length && length <= (eot - sp)/2, Exiv2::kerCorruptedMetadata); // Allocate space if (length == 0)