From: Ross Burton <ross.burton@arm.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 4/6] libexif: backport fixes for CVE-2026-40385/CVE-2026-40386/CVE-2026-32775
Date: Tue, 14 Apr 2026 16:56:50 +0100 [thread overview]
Message-ID: <20260414155652.1214302-4-ross.burton@arm.com> (raw)
In-Reply-To: <20260414155652.1214302-1-ross.burton@arm.com>
Backport the fixes for these three CVEs from upstream.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
.../0001-check-maxlen-to-be-at-least-1.patch | 74 +++++++++++++++++++
...-fixed-2-unsigned-integer-underflows.patch | 46 ++++++++++++
...n-32bit-system-when-reading-Nikon-Ma.patch | 36 +++++++++
.../recipes-support/libexif/libexif_0.6.25.bb | 3 +
4 files changed, 159 insertions(+)
create mode 100644 meta/recipes-support/libexif/libexif/0001-check-maxlen-to-be-at-least-1.patch
create mode 100644 meta/recipes-support/libexif/libexif/0002-fixed-2-unsigned-integer-underflows.patch
create mode 100644 meta/recipes-support/libexif/libexif/0003-Avoid-overflow-on-32bit-system-when-reading-Nikon-Ma.patch
diff --git a/meta/recipes-support/libexif/libexif/0001-check-maxlen-to-be-at-least-1.patch b/meta/recipes-support/libexif/libexif/0001-check-maxlen-to-be-at-least-1.patch
new file mode 100644
index 00000000000..e5b7eb14b5b
--- /dev/null
+++ b/meta/recipes-support/libexif/libexif/0001-check-maxlen-to-be-at-least-1.patch
@@ -0,0 +1,74 @@
+From 2d12cc141c4d799cea2b42639645db5142940ff7 Mon Sep 17 00:00:00 2001
+From: Marcus Meissner <marcus@jet.franken.de>
+Date: Mon, 9 Mar 2026 10:02:53 +0100
+Subject: [PATCH 1/3] check maxlen to be at least 1
+
+maxlen-- on 0 will become a high value.
+
+(likely found by AI)
+
+Fixes https://github.com/libexif/libexif/issues/247
+
+CVE: CVE-2026-32775
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ libexif/canon/mnote-canon-entry.c | 2 ++
+ libexif/fuji/mnote-fuji-entry.c | 1 +
+ libexif/olympus/mnote-olympus-entry.c | 2 ++
+ libexif/pentax/mnote-pentax-entry.c | 1 +
+ 5 files changed, 8 insertions(+)
+
+diff --git a/libexif/canon/mnote-canon-entry.c b/libexif/canon/mnote-canon-entry.c
+index de0fac4..2849d5b 100644
+--- a/libexif/canon/mnote-canon-entry.c
++++ b/libexif/canon/mnote-canon-entry.c
+@@ -561,6 +561,8 @@ mnote_canon_entry_get_value (const MnoteCanonEntry *entry, unsigned int t, char
+
+ if (!entry)
+ return NULL;
++ if (maxlen < 1)
++ return NULL;
+
+ data = entry->data;
+ size = entry->size;
+diff --git a/libexif/fuji/mnote-fuji-entry.c b/libexif/fuji/mnote-fuji-entry.c
+index 47e01ed..5d9f16f 100644
+--- a/libexif/fuji/mnote-fuji-entry.c
++++ b/libexif/fuji/mnote-fuji-entry.c
+@@ -201,6 +201,7 @@ mnote_fuji_entry_get_value (MnoteFujiEntry *entry,
+ int i, j;
+
+ if (!entry) return (NULL);
++ if (maxlen < 1) return NULL;
+
+ memset (val, 0, maxlen);
+ maxlen--;
+diff --git a/libexif/olympus/mnote-olympus-entry.c b/libexif/olympus/mnote-olympus-entry.c
+index e5200be..f938d40 100644
+--- a/libexif/olympus/mnote-olympus-entry.c
++++ b/libexif/olympus/mnote-olympus-entry.c
+@@ -286,6 +286,8 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m
+
+ if (!entry)
+ return (NULL);
++ if (maxlen < 1)
++ return NULL;
+
+ memset (v, 0, maxlen);
+ maxlen--;
+diff --git a/libexif/pentax/mnote-pentax-entry.c b/libexif/pentax/mnote-pentax-entry.c
+index 46900c3..0a6f87a 100644
+--- a/libexif/pentax/mnote-pentax-entry.c
++++ b/libexif/pentax/mnote-pentax-entry.c
+@@ -317,6 +317,7 @@ mnote_pentax_entry_get_value (MnotePentaxEntry *entry,
+ int i = 0, j = 0;
+
+ if (!entry) return (NULL);
++ if (maxlen < 1) return (NULL);
+
+ memset (val, 0, maxlen);
+ maxlen--;
+--
+2.43.0
+
diff --git a/meta/recipes-support/libexif/libexif/0002-fixed-2-unsigned-integer-underflows.patch b/meta/recipes-support/libexif/libexif/0002-fixed-2-unsigned-integer-underflows.patch
new file mode 100644
index 00000000000..2879d488f61
--- /dev/null
+++ b/meta/recipes-support/libexif/libexif/0002-fixed-2-unsigned-integer-underflows.patch
@@ -0,0 +1,46 @@
+From ef8d6041d567bcf2b7f466b1bad470689fb4d159 Mon Sep 17 00:00:00 2001
+From: Marcus Meissner <meissner@suse.de>
+Date: Thu, 2 Apr 2026 13:26:31 +0200
+Subject: [PATCH 2/3] fixed 2 unsigned integer underflows
+
+this could cause crashes or data leaks.
+
+Reported-by: Kerwin <kerwinxia66001@gmail.com>
+
+CVE: CVE-2026-40386
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ libexif/fuji/exif-mnote-data-fuji.c | 2 +-
+ libexif/olympus/exif-mnote-data-olympus.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libexif/fuji/exif-mnote-data-fuji.c b/libexif/fuji/exif-mnote-data-fuji.c
+index c28c541..2dcb877 100644
+--- a/libexif/fuji/exif-mnote-data-fuji.c
++++ b/libexif/fuji/exif-mnote-data-fuji.c
+@@ -70,7 +70,7 @@ exif_mnote_data_fuji_get_value (ExifMnoteData *d, unsigned int i, char *val, uns
+ ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) d;
+
+ if (!d || !val) return NULL;
+- if (i > n->count -1) return NULL;
++ if (i >= n->count) return NULL;
+ /*
+ exif_log (d->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataFuji",
+ "Querying value for tag '%s'...",
+diff --git a/libexif/olympus/exif-mnote-data-olympus.c b/libexif/olympus/exif-mnote-data-olympus.c
+index a57af17..428f365 100644
+--- a/libexif/olympus/exif-mnote-data-olympus.c
++++ b/libexif/olympus/exif-mnote-data-olympus.c
+@@ -78,7 +78,7 @@ exif_mnote_data_olympus_get_value (ExifMnoteData *d, unsigned int i, char *val,
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
+
+ if (!d || !val) return NULL;
+- if (i > n->count -1) return NULL;
++ if (i >= n->count) return NULL;
+ /*
+ exif_log (d->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
+ "Querying value for tag '%s'...",
+--
+2.43.0
+
diff --git a/meta/recipes-support/libexif/libexif/0003-Avoid-overflow-on-32bit-system-when-reading-Nikon-Ma.patch b/meta/recipes-support/libexif/libexif/0003-Avoid-overflow-on-32bit-system-when-reading-Nikon-Ma.patch
new file mode 100644
index 00000000000..e1f9d12a7cc
--- /dev/null
+++ b/meta/recipes-support/libexif/libexif/0003-Avoid-overflow-on-32bit-system-when-reading-Nikon-Ma.patch
@@ -0,0 +1,36 @@
+From 62f657ab2b01ede7ab85adbdec333c81176518e9 Mon Sep 17 00:00:00 2001
+From: Marcus Meissner <meissner@suse.de>
+Date: Fri, 3 Apr 2026 11:18:47 +0200
+Subject: [PATCH 3/3] Avoid overflow on 32bit system when reading Nikon
+ MakerNotes
+
+The addition o2 = datao + exif_get_long(buf + o2, n->order)
+could have overflowed on systems with 32bit unsigned int size_t.
+
+This could have caused out of bound reads of data, leading to
+misparsing of exif / crashes.
+
+Reported-By: Kerwin <kerwinxia66001@gmail.com>
+
+CVE: CVE-2026-40385
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ libexif/olympus/exif-mnote-data-olympus.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libexif/olympus/exif-mnote-data-olympus.c b/libexif/olympus/exif-mnote-data-olympus.c
+index 428f365..37f08ff 100644
+--- a/libexif/olympus/exif-mnote-data-olympus.c
++++ b/libexif/olympus/exif-mnote-data-olympus.c
+@@ -386,6 +386,7 @@ exif_mnote_data_olympus_load (ExifMnoteData *en,
+ o2 += 2;
+
+ /* Go to where the number of entries is. */
++ if (CHECKOVERFLOW(o2,buf_size,exif_get_long (buf + o2, n->order))) return;
+ o2 = datao + exif_get_long (buf + o2, n->order);
+ break;
+
+--
+2.43.0
+
diff --git a/meta/recipes-support/libexif/libexif_0.6.25.bb b/meta/recipes-support/libexif/libexif_0.6.25.bb
index c57855303f4..d869f8c6c3b 100644
--- a/meta/recipes-support/libexif/libexif_0.6.25.bb
+++ b/meta/recipes-support/libexif/libexif_0.6.25.bb
@@ -9,6 +9,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad"
SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libexif-${PV}.tar.bz2 \
file://0001-Add-serial-tests-config-needed-by-ptest.patch \
+ file://0001-check-maxlen-to-be-at-least-1.patch \
+ file://0002-fixed-2-unsigned-integer-underflows.patch \
+ file://0003-Avoid-overflow-on-32bit-system-when-reading-Nikon-Ma.patch \
file://run-ptest \
"
--
2.43.0
next prev parent reply other threads:[~2026-04-14 15:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 15:56 [PATCH 1/6] graphene: ignore CVE-2024-1984 Ross Burton
2026-04-14 15:56 ` [PATCH 2/6] re2c: backport fix for CVE-2026-2903 Ross Burton
2026-04-14 15:56 ` [PATCH 3/6] python3-requests: backport fix for CVE-2026-25645 Ross Burton
2026-04-14 15:56 ` Ross Burton [this message]
2026-04-15 19:10 ` [OE-core] [PATCH 4/6] libexif: backport fixes for CVE-2026-40385/CVE-2026-40386/CVE-2026-32775 Marko, Peter
2026-04-15 21:13 ` Ross Burton
2026-04-14 15:56 ` [PATCH 5/6] perl: link to the system zlib instead of a vendored copy Ross Burton
2026-04-14 15:56 ` [PATCH 6/6] perl: link to the system bzip2 " Ross Burton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260414155652.1214302-4-ross.burton@arm.com \
--to=ross.burton@arm.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox