Blame SOURCES/exiv2-CVE-2021-31291.patch

046469
From 13e5a3e02339b746abcaee6408893ca2fd8e289d Mon Sep 17 00:00:00 2001
046469
From: Pydera <pydera@mailbox.org>
046469
Date: Thu, 8 Apr 2021 17:36:16 +0200
046469
Subject: [PATCH] Fix out of buffer access in #1529
046469
046469
---
046469
 src/jp2image.cpp | 5 +++--
046469
 1 file changed, 3 insertions(+), 2 deletions(-)
046469
046469
diff --git a/src/jp2image.cpp b/src/jp2image.cpp
046469
index 1892fd4..01a21f2 100644
046469
--- a/src/jp2image.cpp
046469
+++ b/src/jp2image.cpp
046469
@@ -737,9 +737,10 @@ namespace Exiv2
046469
 #endif
046469
                 box.length = io_->size() - io_->tell() + 8;
046469
             }
046469
-            if (box.length == 1)
046469
+            if (box.length < 8)
046469
             {
046469
-                // FIXME. Special case. the real box size is given in another place.
046469
+                // box is broken, so there is nothing we can do here
046469
+                throw Error(kerCorruptedMetadata);
046469
             }
046469
046469
             // Read whole box : Box header + Box data (not fixed size - can be null).