diff -u cups-1.4.1/debian/changelog cups-1.4.1/debian/changelog --- cups-1.4.1/debian/changelog +++ cups-1.4.1/debian/changelog @@ -1,3 +1,23 @@ +cups (1.4.1-5ubuntu2.2) karmic-proposed; urgency=low + + * debian/local/filters/pdf-filters/pdftopdf/P2PDoc.cxx, + debian/local/filters/pdf-filters/pdftopdf/P2PGfx.cxx, + debian/local/filters/pdf-filters/pdftopdf/P2PGfx.h, + debian/local/filters/pdf-filters/pdftopdf/P2PObject.h, + debian/local/filters/pdf-filters/pdftopdf/P2POutput.cxx: Upstream + fix from Koji Otani for the following: (1) Fixed some memory leak; + (2) pdftopdf now delays fetching a referenced object until when it is + written to the output. This fixes memory hogging with N-up output + (N pages per sheet). The fix is mainly done by (2). This fixes + LP: #508731. + * debian/local/filters/pdf-filters/pdftopdf/P2PGfx.cxx: Fixed segfault of + the pdftopdf filter when the input PDF file has ICC-profile-based color + space inline images. Thanks to Koji Otani for the fix. Fixes LP: #407344. + * debian/local/filters/cpdftocps: Fixed turning off duplex via command line + (http://bugs.linux-foundation.org/show_bug.cgi?id=397, LP: #487902). + + -- Till Kamppeter Tue, 26 Jan 2009 12:10:20 +0100 + cups (1.4.1-5ubuntu2.1) karmic-security; urgency=low * SECURITY UPDATE: XSS and CRLF injection in headers diff -u cups-1.4.1/debian/local/filters/cpdftocps cups-1.4.1/debian/local/filters/cpdftocps --- cups-1.4.1/debian/local/filters/cpdftocps +++ cups-1.4.1/debian/local/filters/cpdftocps @@ -54,9 +54,9 @@ duplex=no if test -e "$PPD"; then - eval "$(sed -nre 's/^\*Default(sides|Duplex|EFDuplex|EFDuplexing|KD03Duplex|JCLDuplex):\s*(two-sided|Duplex|On|True|Yes|1).*/duplex="yes"/pi' "$PPD")" + eval "$(sed -nre 's/^\*Default(sides|Duplex|EFDuplex|EFDuplexing|KD03Duplex|JCLDuplex):\s*(two-sided|Duplex|On|True|Yes|1)\b.*/duplex="yes"/pi' "$PPD")" fi -eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(sides|Duplex|EFDuplex|EFDuplexing|KD03Duplex|JCLDuplex)=(two-sided|Duplex|On|True|Yes|1).*/duplex="yes"/pi')" +eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(sides|Duplex|EFDuplex|EFDuplexing|KD03Duplex|JCLDuplex)=(two-sided|Duplex|On|True|Yes|1)\b.*/duplex="yes"/pi')" echo "DEBUG: Duplex: $duplex" >&2 resolution= diff -u cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.cxx cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.cxx --- cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.cxx +++ cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.cxx @@ -110,9 +110,14 @@ str = strA; fontResource = fontResourceA; resources = resourcesA; + + /* make dummy GfxState for initializing color space */ + PDFRectangle box; + GfxState state(72,72,&box,0,gFalse); } P2PGfx::~P2PGfx() { + state.clean(); } void P2PGfx::outputContents(Object *obj, P2PResourceMap *mappingTableA, diff -u cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2POutput.cxx cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2POutput.cxx --- cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2POutput.cxx +++ cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2POutput.cxx @@ -138,7 +138,7 @@ Object obj; if ((p2pobj = P2PObject::find(ref->num,ref->gen)) == 0) { - xref->fetch(ref->num,ref->gen,&obj); + obj.initRef(ref->num, ref->gen); p2pobj = new P2PObj(&obj, ref->num, ref->gen); obj.free(); } diff -u cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PDoc.cxx cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PDoc.cxx --- cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PDoc.cxx +++ cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PDoc.cxx @@ -60,11 +60,6 @@ char version[10]; XRef *xref = orgDoc->getXRef(); Object obj; - GBool outputTitle = gFalse; - GBool outputCreationDate = gFalse; - GBool outputModDate = gFalse; - GBool outputTrapped = gFalse; - GBool outputProducer = gFalse; /* get time data */ curtime = time(NULL); @@ -102,52 +97,15 @@ num,gen); str->puts("/Info << "); - if (orgDoc->getDocInfo(&obj) == 0) { - Dict *info = obj.getDict(); - int i; - int n = info->getLength(); - - for (i = 0;i < n;i++) { -#ifdef HAVE_UGOOSTRING_H - char *key = info->getKey(i)->getCString(); -#else - char *key = info->getKey(i); -#endif - Object val; - - if (info->getValNF(i,&val) != 0) { - P2POutput::outputName(key,str); - str->putchar(' '); - P2POutput::outputObject(&val,str,xref); - if (strcmp(key,"Producer") == 0) { - outputProducer = gTrue; - } else if (strcmp(key,"Trapped") == 0) { - outputTrapped = gTrue; - } else if (strcmp(key,"ModDate") == 0) { - outputModDate = gTrue; - } else if (strcmp(key,"CreationDate") == 0) { - outputCreationDate = gTrue; - } else if (strcmp(key,"Title") == 0) { - outputTitle = gTrue; - } - } - - val.free(); -#ifdef HAVE_UGOOSTRING_H - delete[] key; -#endif - } - obj.free(); - } - if (!outputTitle && options.title != 0) { + if (options.title != 0) { str->puts("/Title "); P2POutput::outputString(options.title,strlen(options.title),str); str->putchar(' '); } - if (!outputCreationDate) str->printf("/CreationDate (%s) ",curdate); - if (!outputModDate) str->printf("/ModDate (%s) ",curdate); - if (!outputProducer) str->puts("/Producer (pdftopdf) "); - if (!outputTrapped) str->puts("/Trapped /False"); + str->printf("/CreationDate (%s) ",curdate); + str->printf("/ModDate (%s) ",curdate); + str->puts("/Producer (pdftopdf) "); + str->puts("/Trapped /False"); str->puts(" >>\n"); str->puts(">>\n"); diff -u cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PObject.h cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PObject.h --- cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PObject.h +++ cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PObject.h @@ -146,7 +146,17 @@ getNum(&num,&gen); if (num > 0) outputBegin(str); - P2POutput::outputObject(&obj,str,xref); + if (obj.isRef()) { + Object fobj; + Ref ref; + + ref = obj.getRef(); + xref->fetch(ref.num,ref.gen,&fobj); + P2POutput::outputObject(&fobj,str,xref); + fobj.free(); + } else { + P2POutput::outputObject(&obj,str,xref); + } str->putchar('\n'); if (num > 0) outputEnd(str); } diff -u cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.h cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.h --- cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.h +++ cups-1.4.1/debian/local/filters/pdf-filters/pdftopdf/P2PGfx.h @@ -68,19 +68,23 @@ next = 0; } + void clean() { + while (next != 0) { + restore(); + } + } + ~P2PGfxState() { - if (next != 0) { - delete next; - } + clean(); } void copy(P2PGfxState *src) { font = src->font; } - P2PGfxState(P2PGfxState *src) { + P2PGfxState(P2PGfxState *src, P2PGfxState *nextA) { copy(src); - next = 0; + next = nextA; } P2PFontDict *getFont() { return font; } @@ -90,12 +94,18 @@ } void save() { - next = new P2PGfxState(this); + next = new P2PGfxState(this,next); } + void restore() { if (next != 0) { - copy(next); - next = next->next; + /* remove next */ + P2PGfxState *oldNext = next; + next = oldNext->next; + oldNext->next = 0; + + copy(oldNext); + delete oldNext; } } private: