diff options
| author | Peter Marko <peter.marko@siemens.com> | 2026-01-15 01:25:44 +0100 |
|---|---|---|
| committer | Paul Barker <paul@pbarker.dev> | 2026-02-27 15:54:02 +0000 |
| commit | 4597dd50ee73880556234590aeeba897a59faa64 (patch) | |
| tree | ddc7758fc2dd2f4a1d3328c8070708e7837bf8be | |
| parent | a3d6476e85f2be79c1b624ac75e02b2c7314f022 (diff) | |
| download | poky-4597dd50ee73880556234590aeeba897a59faa64.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: 078627f4a208623bc236887682f8a1f0c88f2626)
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>
| -rw-r--r-- | meta/recipes-multimedia/libpng/files/CVE-2026-22695.patch | 77 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libpng/libpng_1.6.39.bb | 1 |
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..673411eb34 --- /dev/null +++ b/meta/recipes-multimedia/libpng/files/CVE-2026-22695.patch | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | From e4f7ad4ea2a471776c81dda4846b7691925d9786 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Cosmin Truta <ctruta@gmail.com> | ||
| 3 | Date: Fri, 9 Jan 2026 20:51:53 +0200 | ||
| 4 | Subject: [PATCH] Fix a heap buffer over-read in `png_image_read_direct_scaled` | ||
| 5 | |||
| 6 | Fix a regression from commit 218612ddd6b17944e21eda56caf8b4bf7779d1ea. | ||
| 7 | |||
| 8 | The function `png_image_read_direct_scaled`, introduced by the fix for | ||
| 9 | CVE-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 | ||
| 12 | though `local_row` is only `png_get_rowbytes()` bytes long. | ||
| 13 | |||
| 14 | This causes a heap buffer over-read when: | ||
| 15 | |||
| 16 | 1. 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 | |||
| 20 | 2. 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 | |||
| 24 | The fix consists in using the size of the row buffer for the copy and | ||
| 25 | using the stride for pointer advancement only. | ||
| 26 | |||
| 27 | Reported-by: Petr Simecek <simecek@users.noreply.github.com> | ||
| 28 | Analyzed-by: Stanislav Fort | ||
| 29 | Analyzed-by: Pavel Kohout | ||
| 30 | Co-authored-by: Petr Simecek <simecek@users.noreply.github.com> | ||
| 31 | Signed-off-by: Cosmin Truta <ctruta@gmail.com> | ||
| 32 | |||
| 33 | CVE: CVE-2026-22695 | ||
| 34 | Upstream-Status: Backport [https://github.com/pnggroup/libpng/commit/e4f7ad4ea2a471776c81dda4846b7691925d9786] | ||
| 35 | Signed-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 | |||
| 41 | diff --git a/AUTHORS b/AUTHORS | ||
| 42 | index 26b7bb50f..b9c0fffcf 100644 | ||
| 43 | --- a/AUTHORS | ||
| 44 | +++ b/AUTHORS | ||
| 45 | @@ -22,6 +22,7 @@ Authors, for copyright and licensing purposes. | ||
| 46 | * Mike Klein | ||
| 47 | * Pascal Massimino | ||
| 48 | * Paul Schmidt | ||
| 49 | + * Petr Simecek | ||
| 50 | * Qiang Zhou | ||
| 51 | * Sam Bushell | ||
| 52 | * Samuel Williams | ||
| 53 | diff --git a/pngread.c b/pngread.c | ||
| 54 | index e3426292b..9d86b01dc 100644 | ||
| 55 | --- a/pngread.c | ||
| 56 | +++ b/pngread.c | ||
| 57 | @@ -3268,9 +3268,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 | @@ -3300,7 +3302,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.39.bb b/meta/recipes-multimedia/libpng/libpng_1.6.39.bb index 70685b68e7..9ca68d9b8b 100644 --- a/meta/recipes-multimedia/libpng/libpng_1.6.39.bb +++ b/meta/recipes-multimedia/libpng/libpng_1.6.39.bb | |||
| @@ -22,6 +22,7 @@ SRC_URI = "\ | |||
| 22 | file://CVE-2025-65018-02.patch \ | 22 | file://CVE-2025-65018-02.patch \ |
| 23 | file://CVE-2025-66293-01.patch \ | 23 | file://CVE-2025-66293-01.patch \ |
| 24 | file://CVE-2025-66293-02.patch \ | 24 | file://CVE-2025-66293-02.patch \ |
| 25 | file://CVE-2026-22695.patch \ | ||
| 25 | " | 26 | " |
| 26 | 27 | ||
| 27 | SRC_URI[sha256sum] = "1f4696ce70b4ee5f85f1e1623dc1229b210029fa4b7aee573df3e2ba7b036937" | 28 | SRC_URI[sha256sum] = "1f4696ce70b4ee5f85f1e1623dc1229b210029fa4b7aee573df3e2ba7b036937" |
