new file mode 100644
@@ -0,0 +1,37 @@
+From 242a059aedc1935097d9aa1dc3f099750467ba75 Mon Sep 17 00:00:00 2001
+From: Andrew Murray <3112309+radarhere@users.noreply.github.com>
+Date: Tue, 6 Oct 2026 16:25:03 +1100
+Subject: [PATCH] Reject JPEG streams whose scanlines are wider or have more
+ components (#10131)
+
+Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
+Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
+Co-authored-by: Jeffrey 'Alex' Clark <aclark@aclark.net>
+
+CVE: CVE-2026-112398 CVE-2026-112403
+Upstream-Status: Backport [https://github.com/python-pillow/Pillow/commit/242a059aedc1935097d9aa1dc3f099750467ba75]
+Backport note: Omit upstream test changes in Tests/test_file_jpeg.py.
+Signed-off-by: Dickson Wu <dickson.wu@certik.com>
+---
+diff --git a/src/libImaging/JpegDecode.c b/src/libImaging/JpegDecode.c
+index 116ffd8df49..476197370e9 100644
+--- a/src/libImaging/JpegDecode.c
++++ b/src/libImaging/JpegDecode.c
+@@ -241,6 +241,17 @@ ImagingJpegDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t by
+ break;
+ }
+
++ /* The scanline buffer was sized from the tile extents and the
++ unpacker, not from the JPEG header, so make sure the lines
++ libjpeg is about to produce actually fit in it. */
++ if (context->cinfo.output_width > (JDIMENSION)state->xsize ||
++ (size_t)context->cinfo.output_components * context->cinfo.output_width >
++ (size_t)state->bytes) {
++ jpeg_destroy_decompress(&context->cinfo);
++ state->errcode = IMAGING_CODEC_BROKEN;
++ return -1;
++ }
++
+ state->state++;
+ /* fall through */
+
@@ -14,6 +14,7 @@ SRC_URI = "git://github.com/python-pillow/Pillow.git;branch=main;protocol=https
file://CVE-2026-59198.patch \
file://CVE-2026-59204.patch \
file://CVE-2026-112393.patch \
+ file://CVE-2026-112398_CVE-2026-112403.patch \
"
SRCREV = "5c89d88eee199ba53f64581ea39b6a1bc52feb1a"