Skip to content

Commit 2fdab9b

Browse files
committed
check page size from pdfium
PDFium allows page width and height to be less than 1, which will cause libvips severe indegestion.
1 parent ede6709 commit 2fdab9b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

libvips/foreign/pdfiumload.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,17 @@ vips_foreign_load_pdf_header( VipsForeignLoad *load )
481481
pdf->pages[i].height = VIPS_RINT(
482482
FPDF_GetPageHeight( pdf->page ) * pdf->scale );
483483

484+
/* PDFium allows page width or height to be less than 1 (!!).
485+
*/
486+
if( pdf->pages[i].width < 1 ||
487+
pdf->pages[i].height < 1 ||
488+
pdf->pages[i].width > VIPS_MAX_COORD ||
489+
pdf->pages[i].height > VIPS_MAX_COORD ) {
490+
vips_error( class->nickname,
491+
"%s", _( "page size out of range" ) );
492+
return( -1 );
493+
}
494+
484495
if( pdf->pages[i].width > pdf->image.width )
485496
pdf->image.width = pdf->pages[i].width;
486497
pdf->image.height += pdf->pages[i].height;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy