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);