From 6e1fd6136de879eed2d8738bc6b915e2fa6a71e6 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 3 Jun 2020 16:41:29 +0100 Subject: [PATCH] safer directory set in tiff load --- libvips/foreign/tiff2vips.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index ef55efd9..3fea1ac3 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -679,7 +679,9 @@ rtiff_n_pages( Rtiff *rtiff ) for( n = 1; TIFFReadDirectory( rtiff->tiff ); n++ ) ; - rtiff->current_page = n - 1; + /* Make sure the nest set_page() will set the directory. + */ + rtiff->current_page = -1; #ifdef DEBUG printf( "rtiff_n_pages: found %d pages\n", n );