fix tiff read with page > 0

could break edge tiles under some circumstances
This commit is contained in:
John Cupitt 2017-05-19 16:07:36 +01:00
parent 2b0ebb0de2
commit 5df65ec6fd
3 changed files with 19 additions and 9 deletions

View File

@ -1,3 +1,6 @@
19/5/17 started 8.5.6
- tiff read with start page > 0 could break edge tiles or strips
23/4/17 started 8.5.5
- doc polishing
- more improvements for truncated PNG files, thanks juyunsang

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips], [8.5.5], [vipsip@jiscmail.ac.uk])
AC_INIT([vips], [8.5.6], [vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ(2.62)
@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [8])
m4_define([vips_minor_version], [5])
m4_define([vips_micro_version], [5])
m4_define([vips_micro_version], [6])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=49
LIBRARY_REVISION=4
LIBRARY_REVISION=5
LIBRARY_AGE=7
# patched into include/vips/version.h

View File

@ -173,6 +173,8 @@
* - invalidate operation on read error
* 27/1/17
* - if rows_per_strip is large, read with scanline API instead
* 19/5/17
* - page > 0 could break edge tiles or strips
*/
/*
@ -1469,8 +1471,11 @@ rtiff_fill_region( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop
x = 0;
while( x < r->width ) {
int page_no = rtiff->page + (r->top + y) /
rtiff->header.height;
/* page_no is within this toilet roll image, not tiff
* file page number ... add the number of the start
* page to get that.
*/
int page_no = (r->top + y) / rtiff->header.height;
int page_y = (r->top + y) % rtiff->header.height;
/* Coordinate of the tile on this page that xy falls in.
@ -1478,7 +1483,7 @@ rtiff_fill_region( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop
int xs = ((r->left + x) / tile_width) * tile_width;
int ys = (page_y / tile_height) * tile_height;
if( rtiff_set_page( rtiff, page_no ) ||
if( rtiff_set_page( rtiff, rtiff->page + page_no ) ||
rtiff_read_tile( rtiff, buf, xs, ys ) ) {
VIPS_GATE_STOP( "rtiff_fill_region: work" );
return( -1 );
@ -1744,9 +1749,11 @@ rtiff_stripwise_generate( VipsRegion *or,
y = 0;
while( y < r->height ) {
/* Page number, position within this page.
/* page_no is within this toilet roll image, not tiff
* file page number ... add the number of the start
* page to get that.
*/
int page_no = rtiff->page + (r->top + y) / page_height;
int page_no = (r->top + y) / page_height;
int y_page = (r->top + y) % page_height;
/* Strip number.
@ -1785,7 +1792,7 @@ rtiff_stripwise_generate( VipsRegion *or,
g_assert( hit.height > 0 );
if( rtiff_set_page( rtiff, page_no ) ) {
if( rtiff_set_page( rtiff, rtiff->page + page_no ) ) {
VIPS_GATE_STOP( "rtiff_stripwise_generate: work" );
return( -1 );
}