Fix more issues found by fuzzer

This commit is contained in:
Luis Díaz Más
2022-02-27 12:42:08 +01:00
parent 12738214f2
commit e07c3771da
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -303,8 +303,8 @@ namespace Exiv2
std::string id;
// Check that the string has a '\0' terminator.
const char* str = data.c_str(skip);
const auto maxlen = static_cast<size_t>(data.size() - skip);
enforce(strnlen(str, maxlen) < maxlen, Exiv2::kerCorruptedMetadata);
const size_t maxlen = data.size() - skip;
enforce(maxlen > 0 && strnlen(str, maxlen) < maxlen, Exiv2::kerCorruptedMetadata);
std::string name(str);
if (name.find("Exif") != std::string::npos) { // "Exif" or "ExifExif"
exifID_ = ID;