]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix regression in memory allocations for non-PackBits compression buffers.
authorMichael R Sweet <msweet@msweet.org>
Sat, 1 Aug 2026 14:28:39 +0000 (10:28 -0400)
committerMichael R Sweet <msweet@msweet.org>
Sat, 1 Aug 2026 14:28:39 +0000 (10:28 -0400)
filter/rastertoepson.c
filter/rastertohp.c

index afdfc70d1defccd53040405e1d1577732dc6ea4a..f8005ffed8edbd361330da1cd2d370b22ee6e4ed 100644 (file)
@@ -297,7 +297,15 @@ StartPage(
   for (plane = 1; plane < NumPlanes; plane ++)
     Planes[plane] = Planes[0] + plane * header->cupsBytesPerLine / NumPlanes;
 
-  if (header->cupsCompression || DotBytes)
+  if (DotBytes)
+  {
+    if ((CompBuffer = calloc(2, header->cupsWidth + 1)) == NULL)
+    {
+      fputs("ERROR: Unable to allocate memory\n", stderr);
+      exit(1);
+    }
+  }
+  else if (header->cupsCompression)
   {
     if ((CompBuffer = packbits_alloc(header->cupsBytesPerLine)) == NULL)
     {
index 3d0eb6c705a40475c8a661394243403247ef6716..359256e84b15eda41b2003320902e162a5bd2f69 100644 (file)
@@ -255,8 +255,10 @@ StartPage(ppd_file_t         *ppd, /* I - PPD file */
   for (plane = 1; plane < NumPlanes; plane ++)
     Planes[plane] = Planes[0] + plane * header->cupsBytesPerLine / NumPlanes;
 
-  if (header->cupsCompression)
+  if (header->cupsCompression == 2)
     CompBuffer = packbits_alloc(header->cupsBytesPerLine);
+  else if (header->cupsCompression)
+    CompBuffer = malloc(header->cupsBytesPerLine * 2 + 2);
   else
     CompBuffer = NULL;
 }