From a21714f0287174a693e40b7a6b6ad21bf5fd4f09 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 9 Jul 2019 13:56:18 +0200 Subject: [PATCH] TIFFWriteCheck(): call TIFFForceStrileArrayWriting() when needed (should have gone with eaeca6274ae71cdfaeb9f673b6fb0f3cfc0e6ce5) (master only) --- libtiff/tif_write.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libtiff/tif_write.c b/libtiff/tif_write.c index 1bb84e7b..33e803c1 100644 --- a/libtiff/tif_write.c +++ b/libtiff/tif_write.c @@ -626,6 +626,20 @@ TIFFWriteCheck(TIFF* tif, int tiles, const char* module) if (tif->tif_scanlinesize == 0) return (0); tif->tif_flags |= TIFF_BEENWRITING; + + if( tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 && + tif->tif_dir.td_stripoffset_entry.tdir_count == 0 && + tif->tif_dir.td_stripoffset_entry.tdir_type == 0 && + tif->tif_dir.td_stripoffset_entry.tdir_offset.toff_long8 == 0 && + tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 && + tif->tif_dir.td_stripbytecount_entry.tdir_count == 0 && + tif->tif_dir.td_stripbytecount_entry.tdir_type == 0 && + tif->tif_dir.td_stripbytecount_entry.tdir_offset.toff_long8 == 0 && + !(tif->tif_flags & TIFF_DIRTYDIRECT) ) + { + TIFFForceStrileArrayWriting(tif); + } + return (1); }