]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: In imagetoraster() fixed crash with SGray
authorTill Kamppeter <till.kamppeter@gmail.com>
Tue, 4 Jan 2022 20:07:50 +0000 (17:07 -0300)
committerTill Kamppeter <till.kamppeter@gmail.com>
Tue, 4 Jan 2022 20:07:50 +0000 (17:07 -0300)
As the SGray color space was not mentioned in the switch for selecting
the raster line formatting function, a 3-channel color formatting
function was selected instead of the 1-channel grayscale one, leading
to an overrun of the input pixel line, causing a crash.

This is fixed now by also mentioning the 3 standard color spaces for
driverless printing, SGray, SRGB, and AdobeRGB explicily (where for
the latter 2 the selection already worked as they are 3-channel color
options).

Fixes https://github.com/OpenPrinting/cups-filters/issues/435

cupsfilters/imagetoraster.c

index 35305496c8e3014ccc079b192c6e00ebaf1dcf5e..a63ae7e8b68a9612bfb398027f1ce2c0472d0eb6 100644 (file)
@@ -1815,11 +1815,14 @@ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "doc.color = %d", doc.Color);
             switch (header.cupsColorSpace)
            {
              case CUPS_CSPACE_W :
+             case CUPS_CSPACE_SW :
                  format_W(&doc, &header, row, y, plane, z->xsize, z->ysize,
                           yerr0, yerr1, r0, r1);
                  break;
               default :
              case CUPS_CSPACE_RGB :
+             case CUPS_CSPACE_SRGB :
+             case CUPS_CSPACE_ADOBERGB :
                  format_RGB(&doc, &header, row, y, plane, z->xsize, z->ysize,
                             yerr0, yerr1, r0, r1);
                  break;