summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2026-01-15 01:25:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2026-02-16 09:52:34 +0000
commitf824456616843cb2b6bbb901c8ca26c4db1db275 (patch)
tree79674676daa2cb07d5f49201f9e3288dee02e932
parent2541663fd18c188a12738e50e24f1ae3a682ce2c (diff)
downloadpoky-f824456616843cb2b6bbb901c8ca26c4db1db275.tar.gz
libpng: patch CVE-2026-22695
Pick commit per [1]. This CVE is regression of fix for CVE-2025-65018. [1] https://security-tracker.debian.org/tracker/CVE-2026-22695 (From OE-Core rev: cdfeb4e55f856b1020caf58f380d3a1e7eb5cd97) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Paul Barker <paul@pbarker.dev> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-multimedia/libpng/files/CVE-2026-22695.patch77
-rw-r--r--meta/recipes-multimedia/libpng/libpng_1.6.42.bb1
2 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/libpng/files/CVE-2026-22695.patch b/meta/recipes-multimedia/libpng/files/CVE-2026-22695.patch
new file mode 100644
index 0000000000..6456b6c491
--- /dev/null
+++ b/meta/recipes-multimedia/libpng/files/CVE-2026-22695.patch
@@ -0,0 +1,77 @@
1From e4f7ad4ea2a471776c81dda4846b7691925d9786 Mon Sep 17 00:00:00 2001
2From: Cosmin Truta <ctruta@gmail.com>
3Date: Fri, 9 Jan 2026 20:51:53 +0200
4Subject: [PATCH] Fix a heap buffer over-read in `png_image_read_direct_scaled`
5
6Fix a regression from commit 218612ddd6b17944e21eda56caf8b4bf7779d1ea.
7
8The function `png_image_read_direct_scaled`, introduced by the fix for
9CVE-2025-65018, copies transformed row data from an intermediate buffer
10(`local_row`) to the user's output buffer. The copy incorrectly used
11`row_bytes` (the caller's stride) as the size parameter to memcpy, even
12though `local_row` is only `png_get_rowbytes()` bytes long.
13
14This causes a heap buffer over-read when:
15
161. The caller provides a padded stride (e.g., for memory alignment):
17 memcpy reads past the end of `local_row` by `stride - row_width`
18 bytes.
19
202. The caller provides a negative stride (for bottom-up layouts):
21 casting ptrdiff_t to size_t produces ~2^64, causing memcpy to
22 attempt reading exabytes, resulting in an immediate crash.
23
24The fix consists in using the size of the row buffer for the copy and
25using the stride for pointer advancement only.
26
27Reported-by: Petr Simecek <simecek@users.noreply.github.com>
28Analyzed-by: Stanislav Fort
29Analyzed-by: Pavel Kohout
30Co-authored-by: Petr Simecek <simecek@users.noreply.github.com>
31Signed-off-by: Cosmin Truta <ctruta@gmail.com>
32
33CVE: CVE-2026-22695
34Upstream-Status: Backport [https://github.com/pnggroup/libpng/commit/e4f7ad4ea2a471776c81dda4846b7691925d9786]
35Signed-off-by: Peter Marko <peter.marko@siemens.com>
36---
37 AUTHORS | 1 +
38 pngread.c | 4 +++-
39 2 files changed, 4 insertions(+), 1 deletion(-)
40
41diff --git a/AUTHORS b/AUTHORS
42index 26b7bb50f..b9c0fffcf 100644
43--- a/AUTHORS
44+++ b/AUTHORS
45@@ -23,6 +23,7 @@ Authors, for copyright and licensing purposes.
46 * Mike Klein
47 * Pascal Massimino
48 * Paul Schmidt
49+ * Petr Simecek
50 * Philippe Antoine
51 * Qiang Zhou
52 * Sam Bushell
53diff --git a/pngread.c b/pngread.c
54index e3426292b..9d86b01dc 100644
55--- a/pngread.c
56+++ b/pngread.c
57@@ -3270,9 +3270,11 @@ png_image_read_direct_scaled(png_voidp argument)
58 argument);
59 png_imagep image = display->image;
60 png_structrp png_ptr = image->opaque->png_ptr;
61+ png_inforp info_ptr = image->opaque->info_ptr;
62 png_bytep local_row = png_voidcast(png_bytep, display->local_row);
63 png_bytep first_row = png_voidcast(png_bytep, display->first_row);
64 ptrdiff_t row_bytes = display->row_bytes;
65+ size_t copy_bytes = png_get_rowbytes(png_ptr, info_ptr);
66 int passes;
67
68 /* Handle interlacing. */
69@@ -3302,7 +3304,7 @@ png_image_read_direct_scaled(png_voidp argument)
70 png_read_row(png_ptr, local_row, NULL);
71
72 /* Copy from local_row to user buffer. */
73- memcpy(output_row, local_row, (size_t)row_bytes);
74+ memcpy(output_row, local_row, copy_bytes);
75 output_row += row_bytes;
76 }
77 }
diff --git a/meta/recipes-multimedia/libpng/libpng_1.6.42.bb b/meta/recipes-multimedia/libpng/libpng_1.6.42.bb
index 6dc7ffe272..fe99e5df09 100644
--- a/meta/recipes-multimedia/libpng/libpng_1.6.42.bb
+++ b/meta/recipes-multimedia/libpng/libpng_1.6.42.bb
@@ -21,6 +21,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/${PV}/${BP}.tar.xz
21 file://CVE-2025-65018-02.patch \ 21 file://CVE-2025-65018-02.patch \
22 file://CVE-2025-66293-01.patch \ 22 file://CVE-2025-66293-01.patch \
23 file://CVE-2025-66293-02.patch \ 23 file://CVE-2025-66293-02.patch \
24 file://CVE-2026-22695.patch \
24" 25"
25 26
26SRC_URI[sha256sum] = "c919dbc11f4c03b05aba3f8884d8eb7adfe3572ad228af972bb60057bdb48450" 27SRC_URI[sha256sum] = "c919dbc11f4c03b05aba3f8884d8eb7adfe3572ad228af972bb60057bdb48450"