block resolutions < 0

since they can trigger a sanity failure in the test suite
This commit is contained in:
John Cupitt 2022-03-22 15:09:13 +00:00
parent 1b97b52318
commit 9713a71bf0
2 changed files with 6 additions and 4 deletions

View File

@ -464,8 +464,10 @@ vips_image_resolution_from_exif( VipsImage *image, ExifData *ed )
"seen exif resolution %g, %g p/mm\n", xres, yres );
#endif /*DEBUG*/
image->Xres = xres;
image->Yres = yres;
/* Don't allow negative resolution.
*/
image->Xres = VIPS_MAX( 0, xres );
image->Yres = VIPS_MAX( 0, yres );
return( 0 );
}

View File

@ -1014,8 +1014,8 @@ vips_image_init_fields( VipsImage *image,
image->Coding = coding;
image->Type = interpretation;
image->Xres = xres;
image->Yres = yres;
image->Xres = VIPS_MAX( 0, xres );
image->Yres = VIPS_MAX( 0, yres );
}
static void *