From e6a0982f7cd9282052b6e3485a458d60629ffa0b Mon Sep 17 00:00:00 2001
From: Kevin Backhouse <kevinbackhouse@github.com>
Date: Fri, 23 Apr 2021 11:44:44 +0100
Subject: [PATCH] Add bounds check in Jp2Image::doWriteMetadata().

---
 src/jp2image.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/jp2image.cpp b/src/jp2image.cpp
index f9be021..40eca0d 100644
--- a/src/jp2image.cpp
+++ b/src/jp2image.cpp
@@ -888,6 +888,7 @@ namespace Exiv2
 
                 case kJp2BoxTypeUuid:
                 {
+		    enforce(boxBuf.size_ >= 24, Exiv2::kerCorruptedMetadata);
                     if(memcmp(boxBuf.pData_ + 8, kJp2UuidExif, 16) == 0)
                     {
 #ifdef DEBUG
-- 
2.23.0

