From c338124d1d1d7583054a7861a1854c4ceb9dfe1c Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Sun, 5 Apr 2026 09:43:03 -0400
Subject: [PATCH] Range check cupsBytesPerLine in rastertoepson.

---
 CHANGES.md             | 1 +
 filter/rastertoepson.c | 6 ++++++
 2 files changed, 7 insertions(+)

#diff --git a/CHANGES.md b/CHANGES.md
#index 884761a816..564d743e04 100644
#--- a/CHANGES.md
#+++ b/CHANGES.md
#@@ -32,6 +32,7 @@ Changes in CUPS v2.4.17 (YYYY-MM-DD)
# - Fixed a bug when then `ippFindXxx` and `ippSetXxx` functions were mixed.
# - Fixed the mapping of supply type keywords to SNMP names.
# - Fixed a bug in the IPP backend when SNMP was disabled.
#+- Fixed a crash bug in the rastertoepson filter.
# 
# 
# Changes in CUPS v2.4.16 (2025-12-04)
--- a/filter/rastertoepson.c
+++ b/filter/rastertoepson.c
@@ -274,6 +274,12 @@ StartPage(
   else
     NumPlanes = 1;
 
+  if (header->cupsBytesPerLine < NumPlanes)
+  {
+    fputs("ERROR: Bad raster data.\n", stderr);
+    exit(1);
+  }
+
   Feed = 0;				/* No blank lines yet */
 
  /*
