From f70b5a22cb2ba5cc15fbcbfb5def169cf5ec33df Mon Sep 17 00:00:00 2001 From: xueshi Date: Sun, 18 Feb 2024 04:19:45 -0600 Subject: [PATCH] Check val_string() for Out-of-bounds check --- exif.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exif.cpp b/exif.cpp index 9b9e05a..51d16e9 100644 --- a/exif.cpp +++ b/exif.cpp @@ -347,7 +347,7 @@ IFEntry parseIFEntry_temp(const unsigned char *buf, const unsigned offs, } // and cut zero byte at the end, since we don't want that in the // std::string - if (result.val_string()[result.val_string().length() - 1] == '\0') { + if (!result.val_string().empty() && result.val_string()[result.val_string().length() - 1] == '\0') { result.val_string().resize(result.val_string().length() - 1); } break;