Skip to content

Commit 9713a71

Browse files
committed
block resolutions < 0
since they can trigger a sanity failure in the test suite
1 parent 1b97b52 commit 9713a71

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

libvips/foreign/exif.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,10 @@ vips_image_resolution_from_exif( VipsImage *image, ExifData *ed )
464464
"seen exif resolution %g, %g p/mm\n", xres, yres );
465465
#endif /*DEBUG*/
466466

467-
image->Xres = xres;
468-
image->Yres = yres;
467+
/* Don't allow negative resolution.
468+
*/
469+
image->Xres = VIPS_MAX( 0, xres );
470+
image->Yres = VIPS_MAX( 0, yres );
469471

470472
return( 0 );
471473
}

libvips/iofuncs/header.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,8 +1014,8 @@ vips_image_init_fields( VipsImage *image,
10141014

10151015
image->Coding = coding;
10161016
image->Type = interpretation;
1017-
image->Xres = xres;
1018-
image->Yres = yres;
1017+
image->Xres = VIPS_MAX( 0, xres );
1018+
image->Yres = VIPS_MAX( 0, yres );
10191019
}
10201020

10211021
static void *

0 commit comments

Comments
 (0)