]> 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>
Sat, 15 Jan 2022 23:33:52 +0000 (20:33 -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

(cherry picked from commit 098579f7082b4acfe628a1490c9c9abb3322cd74)

filter/imagetoraster.c

index f5aef765163b61eb03c5c34f8b841f90ba05052f..aa8422b725d37281d43fdb07ebf6fa12424a6379 100644 (file)
@@ -1451,11 +1451,14 @@ main(int  argc,                         /* I - Number of command-line arguments */
             switch (header.cupsColorSpace)
            {
              case CUPS_CSPACE_W :
+             case CUPS_CSPACE_SW :
                  format_W(&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(&header, row, y, plane, z->xsize, z->ysize,
                             yerr0, yerr1, r0, r1);
                  break;