Merge branch '8.3'

This commit is contained in:
John Cupitt 2016-07-21 07:42:09 +01:00
commit 5bbeac7eff
2 changed files with 14 additions and 2 deletions

View File

@ -30,6 +30,7 @@
18/5/16 started 8.3.2 18/5/16 started 8.3.2
- more robust vips image reading - more robust vips image reading
- more robust tiff read [Matt Richards]
15/4/16 started 8.3.1 15/4/16 started 8.3.1
- rename vips wrapper script, it was still vips-8.2, thanks Benjamin - rename vips wrapper script, it was still vips-8.2, thanks Benjamin

View File

@ -1895,9 +1895,17 @@ my_tiff_read( thandle_t st, tdata_t buffer, tsize_t size )
{ {
ReadTiff *rtiff = (ReadTiff *) st; ReadTiff *rtiff = (ReadTiff *) st;
size_t available = rtiff->len - rtiff->pos; size_t available;
size_t copy = VIPS_MIN( size, available ); size_t copy;
if( rtiff->pos > rtiff->len ) {
vips_error( "tiff2vips",
"%s", _( "read beyond end of buffer" ) );
return( 0 );
}
available = rtiff->len - rtiff->pos;
copy = VIPS_MIN( size, available );
memcpy( buffer, (unsigned char *) rtiff->buf + rtiff->pos, copy ); memcpy( buffer, (unsigned char *) rtiff->buf + rtiff->pos, copy );
rtiff->pos += copy; rtiff->pos += copy;
@ -1918,6 +1926,9 @@ my_tiff_close( thandle_t st )
return 0; return 0;
} }
/* After calling this, ->pos is not bound by the size of the buffer, it can
* have any positive value.
*/
static toff_t static toff_t
my_tiff_seek( thandle_t st, toff_t pos, int whence ) my_tiff_seek( thandle_t st, toff_t pos, int whence )
{ {