don't allow open of compressed files for r+

This commit is contained in:
Frank Warmerdam 2000-09-30 04:18:55 +00:00
parent b435795f0b
commit 8b6b975659
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2000-09-30 Frank Warmerdam <warmerda@cs46980-c>
* Modified TIFFClientOpen() to emit an error on an attempt to
open a comperessed file for update (O_RDWR/r+) access. This is
because the compressor/decompressor code gets very confused when
the mode is O_RDWR, assuming this means writing only. See
bug http://bugzilla.remotesensing.org/show_bug.cgi?id=13
2000-09-27 Frank Warmerdam <warmerda@cs46980-c>
* Added GNULDdso target and switched linux and freebsd to use it.

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_open.c,v 1.4 2000-08-14 18:10:43 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_open.c,v 1.5 2000-09-30 04:18:55 warmerda Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -349,6 +349,14 @@ TIFFClientOpen(
!TIFFMapFileContents(tif, (tdata_t*) &tif->tif_base, &tif->tif_size))
tif->tif_flags &= ~TIFF_MAPPED;
if (TIFFReadDirectory(tif)) {
if( m != O_RDONLY
&& tif->tif_dir.td_compression != COMPRESSION_NONE )
{
TIFFError( name,
"Can't open a compressed TIFF file"
" with compression for update." );
goto bad;
}
tif->tif_rawcc = -1;
tif->tif_flags |= TIFF_BUFFERSETUP;
return (tif);