Re: [MOD] STR #4049: cupsd crashes with PPD files containing bogus paper sizes

Michael Sweet <[email protected]>
Newsgroups gmane.comp.printing.cups.bugs
Message-ID <[email protected]>
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Closed w/Resolution]

Till, we found and fixed this independently a little over a month ago; I'm
attaching the change that we adopted in r10339.

I've also changed the summary to reflect the issue: PPDs with paper sizes
whose dimensions were <= 0 caused this issue since we were unable to
generate a PWG media name for them (invalid sizes).  I think we'll also
update cupstestppd to check for this since this will cause problems for
users if the corresponding size is selected in an application.

Link: http://www.cups.org/str.php?L4049
Version: 1.5.2
Fix Version: 1.6-current (r10339)

_______________________________________________
cups-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/cups-bugs
str4049.patch (text/plain, 1.4 KB)
Index: cups/pwg-media.c
===================================================================
--- cups/pwg-media.c	(revision 10338)
+++ cups/pwg-media.c	(revision 10339)
@@ -3,7 +3,7 @@
  *
  *   PWG media name API implementation for CUPS.
  *
- *   Copyright 2009-2011 by Apple Inc.
+ *   Copyright 2009-2012 by Apple Inc.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Apple Inc. and are protected by Federal copyright
Index: cups/ppd-cache.c
===================================================================
--- cups/ppd-cache.c	(revision 10338)
+++ cups/ppd-cache.c	(revision 10339)
@@ -753,12 +753,15 @@
     }
 
    /*
-    * If we have a similar paper with non-zero margins then we only
-    * want to keep it if it has a larger imageable area length.
+    * If we have a similar paper with non-zero margins then we only want to
+    * keep it if it has a larger imageable area length.  The NULL check is for
+    * dimensions that are <= 0...
     */
 
-    pwg_media      = _pwgMediaForSize(_PWG_FROMPTS(ppd_size->width),
-                                      _PWG_FROMPTS(ppd_size->length));
+    if ((pwg_media = _pwgMediaForSize(_PWG_FROMPTS(ppd_size->width),
+                                      _PWG_FROMPTS(ppd_size->length))) == NULL)
+      continue;
+
     new_width      = pwg_media->width;
     new_length     = pwg_media->length;
     new_left       = _PWG_FROMPTS(ppd_size->left);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.