From e4897e93ed34fe9d1060c15822aaec499450be5b Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Sun, 5 Apr 2026 09:46:51 -0400
Subject: [PATCH] Sanity check HWResolution when writing Apple Raster.

---
 cups/raster-stream.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/cups/raster-stream.c
+++ b/cups/raster-stream.c
@@ -1038,6 +1038,9 @@ _cupsRasterWriteHeader(
 
   if (r->mode == CUPS_RASTER_WRITE_APPLE)
   {
+    if (r->header.HWResolution[0] == 0 || r->header.HWResolution[1] == 0)
+      return (0);
+
     r->rowheight = r->header.HWResolution[0] / r->header.HWResolution[1];
 
     if (r->header.HWResolution[0] != (r->rowheight * r->header.HWResolution[1]))
