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

rastertohp: heap buffer overflow #4601

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

rastertohp: heap buffer overflow #4601

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

Comments

@michaelrsweet
Copy link
Collaborator

Version: 2.0-current
CUPS.org User: pdewacht

In the rastertohp filter, the OutputLine function will copy pixels from the Planes buffer to the ColorBits buffer. For some malformed input data, the ColorBits buffer might be allocated too small, in which case OutputLine will write beyond the end of this buffer.

This can be remotely triggered on a print server that shares a printer that uses the rastertohp filter. Sample file attached.

Found using afl-fuzz.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str4601.patch":

Index: filter/rastertohp.c

--- filter/rastertohp.c (revision 12567)
+++ filter/rastertohp.c (working copy)
@@ -3,7 +3,7 @@
*

  • Hewlett-Packard Page Control Language filter for CUPS.
    *
    • * Copyright 2007-2014 by Apple Inc.
    • * Copyright 2007-2015 by Apple Inc.
  • Copyright 1993-2007 by Easy Software Products.
    *
  • These coded instructions, statements, and computer programs are the
    @@ -354,7 +354,7 @@
    • Allocate memory for a line of graphics...
      */
  • if ((Planes[0] = malloc(header->cupsBytesPerLine)) == NULL)
  • if ((Planes[0] = malloc(header->cupsBytesPerLine + NumPlanes)) == NULL)
    {
    fputs("ERROR: Unable to allocate memory\n", stderr);
    exit(1);
    @@ -369,7 +369,7 @@
    BitBuffer = NULL;

if (header->cupsCompression)

  • CompBuffer = malloc(header->cupsBytesPerLine * 2);
  • CompBuffer = malloc(header->cupsBytesPerLine * 2 + 2);
    else
    CompBuffer = NULL;
    }

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