exiv2: patch CVE-2026-27631

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-27631

Backport the patches referenced by the NVD advisory.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
Gyorgy Sarvari
2026-03-11 10:42:35 +01:00
committed by Anuj Mittal
parent ab099baf93
commit 0fd2ea7e0b
3 changed files with 91 additions and 0 deletions
@@ -0,0 +1,63 @@
From 7a93f203cd72a895b26bb633d51b2448a0f629a3 Mon Sep 17 00:00:00 2001
From: Kevin Backhouse <kevinbackhouse@github.com>
Date: Thu, 26 Feb 2026 21:14:10 +0000
Subject: [PATCH] Regression test for
https://github.com/Exiv2/exiv2/issues/3513
CVE: CVE-2026-27631
Upstream-Status: Backport [https://github.com/Exiv2/exiv2/commit/7adedce8c779e9c7bce843cbaf9eff26bc1659b6]
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
test/data/issue_3513_poc.psd | Bin 0 -> 206 bytes
tests/bugfixes/github/test_issue_3513.py | 17 +++++++++++++++++
.../test_regression_allfiles.py | 1 +
3 files changed, 18 insertions(+)
create mode 100644 test/data/issue_3513_poc.psd
create mode 100644 tests/bugfixes/github/test_issue_3513.py
diff --git a/test/data/issue_3513_poc.psd b/test/data/issue_3513_poc.psd
new file mode 100644
index 0000000000000000000000000000000000000000..b8cf982ccc29e4574783b1317347a8494bce4240
GIT binary patch
literal 206
zcmcC;3J7LkWXND(VPIfj2I6QSp2oldW&@cF4i-+HzAOnKCIbVQ%?V)xNk#^S{{sU!
VK$eS7U=ZX2Ii>-KnHh{ttN=+HebfK|
literal 0
HcmV?d00001
diff --git a/tests/bugfixes/github/test_issue_3513.py b/tests/bugfixes/github/test_issue_3513.py
new file mode 100644
index 000000000..5383470e4
--- /dev/null
+++ b/tests/bugfixes/github/test_issue_3513.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+
+import system_tests
+
+
+class test_issue_3513_PsdImage_readResourceBlock(metaclass=system_tests.CaseMeta):
+ url = "https://github.com/Exiv2/exiv2/issues/3513"
+
+ filename = "$data_path/issue_3513_poc.psd"
+ commands = ["$exiv2 -pp $filename"]
+ retval = [1]
+ stderr = [
+ """$exiv2_exception_message $filename:
+$kerCorruptedMetadata
+"""
+ ]
+ stdout = [""]
diff --git a/tests/regression_tests/test_regression_allfiles.py b/tests/regression_tests/test_regression_allfiles.py
index 6a230e6fc..31f9c844a 100644
--- a/tests/regression_tests/test_regression_allfiles.py
+++ b/tests/regression_tests/test_regression_allfiles.py
@@ -126,6 +126,7 @@ def get_valid_files(data_dir):
"pocIssue283.jpg",
"poc_1522.jp2",
"xmpsdk.xmp",
+ "issue_3513_poc.psd",
"issue_3511_poc.eps",
# large file that creates 11Mb of output so let's exclude it
"ReaganLargeTiff.tiff",
@@ -0,0 +1,26 @@
From 1748fd9763e89a341bdf8a451534067abb964ab2 Mon Sep 17 00:00:00 2001
From: Kevin Backhouse <kevinbackhouse@github.com>
Date: Fri, 27 Feb 2026 10:38:22 +0000
Subject: [PATCH] Check for integer overflow.
CVE: CVE-2026-27631
Upstream-Status: Backport [https://github.com/Exiv2/exiv2/commit/284b4e20229dd6edf492e712871878ae320801fc]
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
src/psdimage.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/psdimage.cpp b/src/psdimage.cpp
index 1a8e4c61c..b2f5247a2 100644
--- a/src/psdimage.cpp
+++ b/src/psdimage.cpp
@@ -287,6 +287,9 @@ void PsdImage::readResourceBlock(uint16_t resourceId, uint32_t resourceSize) {
nativePreview.height_ = getLong(buf + 8, bigEndian);
const uint32_t format = getLong(buf + 0, bigEndian);
+ Internal::enforce(nativePreview.size_ <= static_cast<size_t>(std::numeric_limits<long>::max()),
+ Exiv2::ErrorCode::kerCorruptedMetadata);
+
if (nativePreview.size_ > 0 && nativePreview.position_ > 0) {
io_->seek(static_cast<long>(nativePreview.size_), BasicIo::cur);
if (io_->error() || io_->eof())
@@ -9,6 +9,8 @@ SRC_URI = "git://github.com/Exiv2/exiv2.git;protocol=https;branch=0.28.x;tag=v${
file://CVE-2026-25884-2.patch \
file://CVE-2026-27596-1.patch \
file://CVE-2026-27596-2.patch \
file://CVE-2026-27631-1.patch \
file://CVE-2026-27631-2.patch \
"
SRCREV = "afcb7a8ba84a7de36d2f1ee7689394e078697956"