From f6b073be96311fcc275b2209f03ce64ebbdc3069 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Fri, 31 Jan 2003 16:43:18 +0000 Subject: [PATCH] Dont allow writing image data to preexisting compressed TIFF images --- libtiff/tif_write.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libtiff/tif_write.c b/libtiff/tif_write.c index 06af9960..79a80d8e 100644 --- a/libtiff/tif_write.c +++ b/libtiff/tif_write.c @@ -1,4 +1,4 @@ -/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_write.c,v 1.7 2002-07-31 20:53:15 warmerda Exp $ */ +/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_write.c,v 1.8 2003-01-31 16:43:18 warmerda Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -484,6 +484,24 @@ TIFFWriteCheck(TIFF* tif, int tiles, const char* module) "Can not write scanlines to a tiled image"); return (0); } + + /* + * While we allow compressed TIFF files to be opened in update mode, + * we don't allow writing any image blocks in an existing compressed + * image. Eventually we could do so, by moving blocks that grow + * to the end of the file, but we don't for now. + */ + if (tif->tif_dir.td_stripoffset != NULL + && tif->tif_dir.td_compression != COMPRESSION_NONE ) + { + TIFFError( module, + "%s:\n" + "In place update to compressed TIFF images not " + "supported.", + tif->tif_name ); + return (0); + } + /* * On the first write verify all the required information * has been setup and initialize any data structures that