Merge branch '8.10'

This commit is contained in:
John Cupitt 2020-11-12 13:22:30 +00:00
commit a43e9d3982
4 changed files with 30 additions and 12 deletions

View File

@ -19,7 +19,7 @@
- hide info messages you could get with some older glibs [kleisauke] - hide info messages you could get with some older glibs [kleisauke]
- fix --no-strip on dzsave with icc-profiles [altert] - fix --no-strip on dzsave with icc-profiles [altert]
- better GraphicsMagick image write [bfriesen] - better GraphicsMagick image write [bfriesen]
- Add missing read loops to spng, heif and ppm load [kleisauke] - Add missing read loops to spng, heif, giflib and ppm load [kleisauke]
6/9/20 started 8.10.2 6/9/20 started 8.10.2
- update magicksave/load profile handling [kelilevi] - update magicksave/load profile handling [kelilevi]

View File

@ -351,20 +351,34 @@ vips_foreign_load_gif_close_giflib( VipsForeignLoadGif *gif )
/* Callback from the gif loader. /* Callback from the gif loader.
* *
* Read up to len bytes into buffer, return number of bytes read, 0 for EOF. * Read up to len bytes into buffer, return number of bytes read. This is
* called by giflib exactly as fread, so it does not distinguish between EOF
* and read error.
*/ */
static int static int
vips_giflib_read( GifFileType *file, GifByteType *buf, int n ) vips_giflib_read( GifFileType *file, GifByteType *buf, int n )
{ {
VipsForeignLoadGif *gif = (VipsForeignLoadGif *) file->UserData; VipsForeignLoadGif *gif = (VipsForeignLoadGif *) file->UserData;
gint64 read; int to_read;
read = vips_source_read( gif->source, buf, n ); to_read = n;
if( read == 0 ) while( to_read > 0 ) {
gint64 bytes_read;
bytes_read = vips_source_read( gif->source, buf, n );
if( bytes_read == 0 )
gif->eof = TRUE; gif->eof = TRUE;
if( bytes_read <= 0 )
return( -1 );
if( bytes_read > INT_MAX )
return( -1 );
return( (int) read ); to_read -= bytes_read;
buf += bytes_read;
}
return( (int) n );
} }
/* Open any underlying file resource, then giflib. /* Open any underlying file resource, then giflib.

View File

@ -988,13 +988,14 @@ vips_foreign_load_heif_read( void *data, size_t size, void *userdata )
VipsForeignLoadHeif *heif = (VipsForeignLoadHeif *) userdata; VipsForeignLoadHeif *heif = (VipsForeignLoadHeif *) userdata;
while( size > 0 ) { while( size > 0 ) {
gint64 result; gint64 bytes_read;
result = vips_source_read( heif->source, data, size ); bytes_read = vips_source_read( heif->source, data, size );
if( result <= 0 ) if( bytes_read <= 0 )
return( -1 ); return( -1 );
size -= result; size -= bytes_read;
data += bytes_read;
} }
return( 0 ); return( 0 );

View File

@ -462,10 +462,12 @@ vips_foreign_load_ppm_generate_binary( VipsRegion *or,
n_bytes = sizeof_line; n_bytes = sizeof_line;
while( n_bytes > 0 ) { while( n_bytes > 0 ) {
size_t bytes_read; gint64 bytes_read;
bytes_read = vips_source_read( ppm->source, bytes_read = vips_source_read( ppm->source,
q, sizeof_line ); q, sizeof_line );
if( bytes_read < 0 )
return( -1 );
if( bytes_read == 0 ) { if( bytes_read == 0 ) {
vips_error( class->nickname, vips_error( class->nickname,
"%s", _( "file truncated" ) ); "%s", _( "file truncated" ) );
@ -473,6 +475,7 @@ vips_foreign_load_ppm_generate_binary( VipsRegion *or,
} }
n_bytes -= bytes_read; n_bytes -= bytes_read;
q += bytes_read;
} }
} }