Merge branch '8.8'

This commit is contained in:
John Cupitt 2019-08-29 15:30:20 +01:00
commit 349e76bb85
2 changed files with 35 additions and 2 deletions

View File

@ -30,6 +30,7 @@
- prevent over-pre-shrink in thumbnail [kleisauke]
- fix sharpen with sigma 0.5 [2h4dl]
- sharpen restores input colourspace
- verify bands/format for coded images
24/5/19 started 8.8.1
- improve realpath() use on older libc

View File

@ -25,6 +25,8 @@
* - use O_TMPFILE, if available
* 23/7/18
* - escape ASCII control characters in XML
* 29/8/19
* - verify bands/format for coded images
*/
/*
@ -348,8 +350,8 @@ vips__read_header_bytes( VipsImage *im, unsigned char *from )
from += 4;
if( im->magic != VIPS_MAGIC_INTEL &&
im->magic != VIPS_MAGIC_SPARC ) {
vips_error( "VipsImage", _( "\"%s\" is not a VIPS image" ),
im->filename );
vips_error( "VipsImage",
_( "\"%s\" is not a VIPS image" ), im->filename );
return( -1 );
}
@ -398,6 +400,36 @@ vips__read_header_bytes( VipsImage *im, unsigned char *from )
* pixel interpretation, don't clip them.
*/
/* Coding values imply Bands and BandFmt settings --- make sure they
* are sane.
*/
switch( im->Coding ) {
case VIPS_CODING_NONE:
break;
case VIPS_CODING_LABQ:
if( im->Bands != 4 ||
im->BandFmt != VIPS_FORMAT_UCHAR ) {
vips_error( "VipsImage",
"%s", _( "malformed LABQ image" ) );
return( -1 );
}
break;
case VIPS_CODING_RAD:
if( im->Bands != 4 ||
im->BandFmt != VIPS_FORMAT_UCHAR ) {
vips_error( "VipsImage",
"%s", _( "malformed RAD image" ) );
return( -1 );
}
break;
default:
g_assert_not_reached();
break;
}
return( 0 );
}