Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cups_raster_read_header might divide by zero #4596

Closed
michaelrsweet opened this issue Mar 1, 2015 · 2 comments
Closed

cups_raster_read_header might divide by zero #4596

michaelrsweet opened this issue Mar 1, 2015 · 2 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 2.0-current
CUPS.org User: pdewacht

As noted in STR #4551, cups_raster_read_header will divide by zero if cupsBitsPerColor or cupsBitPerPixel is zero. Instead it should report failure without crashing the program.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str4596.patch":

Index: filter/raster.c

--- filter/raster.c (revision 12597)
+++ filter/raster.c (working copy)
@@ -970,7 +970,7 @@

cups_raster_update(r);

  • return (r->header.cupsBytesPerLine != 0 && r->header.cupsHeight != 0 && (r->header.cupsBytesPerLine % r->bpp) == 0);
  • return (r->header.cupsBitsPerPixel != 0 && r->header.cupsBitsPerColor != 0 && r->header.cupsBytesPerLine != 0 && r->header.cupsHeight != 0 && (r->header.cupsBytesPerLine % r->bpp) == 0);
    }

@@ -1240,6 +1240,9 @@
else
r->bpp = (r->header.cupsBitsPerColor + 7) / 8;

  • if (r->bpp == 0)
  • r->bpp = 1;

/*

  • Set the number of remaining rows...
    */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant