From f7e8db599db0db816718b8a9c4598d9f55d987e7 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 14 Jul 2020 17:56:36 +0100 Subject: [PATCH] spngload warns about trucated files it used to silently work --- libvips/foreign/spngload.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libvips/foreign/spngload.c b/libvips/foreign/spngload.c index 71831965..c6375fa3 100644 --- a/libvips/foreign/spngload.c +++ b/libvips/foreign/spngload.c @@ -203,8 +203,10 @@ vips_foreign_load_png_set_header( VipsForeignLoadPng *png, VipsImage *image ) if( !spng_get_phys( png->ctx, &phys ) ) { /* unit 1 means pixels per metre, otherwise unspecified. */ - xres = phys.units == 1 ? phys.ppu_x / 1000.0 : phys.ppu_x; - yres = phys.units == 1 ? phys.ppu_y / 1000.0 : phys.ppu_y; + xres = phys.unit_specifier == 1 ? + phys.ppu_x / 1000.0 : phys.ppu_x; + yres = phys.unit_specifier == 1 ? + phys.ppu_y / 1000.0 : phys.ppu_y; } vips_image_init_fields( image, @@ -468,6 +470,9 @@ vips_foreign_load_png_generate( VipsRegion *or, printf( " error %s\n", spng_strerror( error ) ); #endif /*DEBUG*/ + g_warning( "%s: %s", + class->nickname, spng_strerror( error ) ); + /* And bail if fail is on. */ if( load->fail ) {