Skip to content

Commit 9228e50

Browse files
authored
vipsload: ensure resolution is positive (#2742)
1 parent dc07b00 commit 9228e50

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libvips/iofuncs/vips.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ vips__read_header_bytes( VipsImage *im, unsigned char *from )
358358
/* We read xres/yres as floats to a staging area, then copy to double
359359
* in the main fields.
360360
*/
361-
im->Xres = im->Xres_float;
362-
im->Yres = im->Yres_float;
361+
im->Xres = VIPS_MAX( 0, im->Xres_float );
362+
im->Yres = VIPS_MAX( 0, im->Yres_float );
363363

364364
/* Some protection against malicious files. We also check predicted
365365
* (based on these values) against real file length, see below.

0 commit comments

Comments
 (0)