Skip to content

Commit fd01543

Browse files
committed
Fix out-of-bounds write in cfFilterPDFToRaster()
PDFs with too large page dimensions could cause an integer overflow and then a too small buffer for the pixel line to be allocated. Fixed this by cropping the page size to the maximum allowed by the standard, 14400x14400pt, 200x200in, 5x5m https://community.adobe.com/t5/indesign-discussions/maximum-width-of-a-pdf/td-p/9217372 Fixes CVE-2025-64503
1 parent b69dfac commit fd01543

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

cupsfilters/pdftoraster.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,20 @@ out_page(pdftoraster_doc_t *doc,
18141814
doc->header.cupsPageSize[0] = l;
18151815
else
18161816
doc->header.cupsPageSize[1] = l;
1817+
1818+
//
1819+
// Maximum allowed page size for PDF is 200x200 inches (~ 5x5 m), or 14400x14400 pt
1820+
// https://community.adobe.com/t5/indesign-discussions/maximum-width-of-a-pdf/td-p/9217372
1821+
//
1822+
if (doc->header.cupsPageSize[0] > 14400) {
1823+
fprintf(stderr, "ERROR: Page width is %.2fpt, too large, cropping to 14400pt\n", doc->header.cupsPageSize[0]);
1824+
doc->header.cupsPageSize[0] = 14400;
1825+
}
1826+
if (doc->header.cupsPageSize[1] > 14400) {
1827+
fprintf(stderr, "ERROR: Page height is %.2fpt, too large, cropping to 14400pt\n", doc->header.cupsPageSize[1]);
1828+
doc->header.cupsPageSize[1] = 14400;
1829+
}
1830+
18171831
if (rotate == 90 || rotate == 270)
18181832
{
18191833
doc->header.cupsImagingBBox[0] =

0 commit comments

Comments
 (0)