vipsload: ensure resolution is positive (#2742)

This commit is contained in:
Lovell Fuller 2022-04-03 11:00:44 +01:00 committed by GitHub
parent dc07b00059
commit 9228e50f46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -358,8 +358,8 @@ vips__read_header_bytes( VipsImage *im, unsigned char *from )
/* We read xres/yres as floats to a staging area, then copy to double
* in the main fields.
*/
im->Xres = im->Xres_float;
im->Yres = im->Yres_float;
im->Xres = VIPS_MAX( 0, im->Xres_float );
im->Yres = VIPS_MAX( 0, im->Yres_float );
/* Some protection against malicious files. We also check predicted
* (based on these values) against real file length, see below.