summaryrefslogtreecommitdiff
path: root/libtiff/tif_write.c
Commit message (Collapse)AuthorAgeFilesLines
* TIFFWriteCheck(): call TIFFForceStrileArrayWriting() when needed (should ↵Even Rouault2019-07-091-0/+14
| | | | have gone with eaeca6274ae71cdfaeb9f673b6fb0f3cfc0e6ce5) (master only)
* Replace 'stripped' by 'striped' in error messagesEven Rouault2019-05-251-1/+1
|
* Make defer strile offset/bytecount loading available at runtimeEven Rouault2019-05-101-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and add per-strile offset/bytecount loading capabilities. Part of this commit makes the behaviour that was previously met when libtiff was compiled with -DDEFER_STRILE_LOAD available for default builds when specifying the new 'D' (Deferred) TIFFOpen() flag. In that mode, the [Tile/Strip][ByteCounts/Offsets] arrays are only loaded when first accessed. This can speed-up the opening of files stored on the network when just metadata retrieval is needed. This mode has been used for years by the GDAL library when compiled with its embeded libtiff copy. To avoid potential out-of-tree code (typically codecs) that would use the td_stripbytecount and td_stripoffset array inconditionnaly assuming they have been loaded, those have been suffixed with _p (for protected). The use of the new functions mentionned below is then recommended. Another addition of this commit is the capability of loading only the values of the offset/bytecount of the strile of interest instead of the whole array. This is enabled with the new 'O' (Ondemand) flag of TIFFOpen() (which implies 'D'). That behaviour has also been used by GDAL, which hacked into the td_stripoffset/td_stripbytecount arrays directly. The new code added in the _TIFFFetchStrileValue() and _TIFFPartialReadStripArray() internal functions is mostly a port of what was in GDAL GTiff driver previously. Related to that, the public TIFFGetStrileOffset[WithErr]() and TIFFGetStrileByteCount[WithErr]() functions have been added to API. They are of particular interest when using sparse files (with offset == bytecount == 0) and you want to detect if a strile is present or not without decompressing the data, or updating an existing sparse file. They will also be used to enable a future enhancement where client code can entirely skip bytecount loading in some situtations A new test/defer_strile_loading.c test has been added to test the above capabilities.
* TIFFWriteEncodedStrip/TIFFWriteEncodedTile: fix rewriting of LZW-compressed dataEven Rouault2019-04-111-37/+35
| | | | | | | | Fixes https://github.com/OSGeo/gdal/issues/1439 When rewriting a LZW tile/strip whose existing size is very close to a multiple of 1024 bytes (and larger than 8192 bytes) with compressed data that is larger, the new data was not placed at the end of the file, causing corruption.
* TIFFSetupStrips(): avoid potential uint32 overflow on 32-bit systems with ↵Even Rouault2018-08-151-2/+4
| | | | large number of strips. Probably relates to http://bugzilla.maptools.org/show_bug.cgi?id=2788 / CVE-2018-10779
* Remove all $Id and $Headers comments with CVS versionsEven Rouault2017-11-301-2/+0
|
* * libtiff/tif_write.c: fix misleading indentation as warned by GCC.Even Rouault2016-12-031-16/+16
|
* * tools/tiffcrop.c: fix various out-of-bounds write vulnerabilitiesEven Rouault2016-09-231-1/+8
| | | | | | | | | | | | | | | | | | | | | | in heap or stack allocated buffers. Reported as MSVR 35093, MSVR 35096 and MSVR 35097. Discovered by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities & Mitigations team. * tools/tiff2pdf.c: fix out-of-bounds write vulnerabilities in heap allocate buffer in t2p_process_jpeg_strip(). Reported as MSVR 35098. Discovered by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities & Mitigations team. * libtiff/tif_pixarlog.c: fix out-of-bounds write vulnerabilities in heap allocated buffers. Reported as MSVR 35094. Discovered by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities & Mitigations team. * libtiff/tif_write.c: fix issue in error code path of TIFFFlushData1() that didn't reset the tif_rawcc and tif_rawcp members. I'm not completely sure if that could happen in practice outside of the odd behaviour of t2p_seekproc() of tiff2pdf). The report points that a better fix could be to check the return value of TIFFFlushData1() in places where it isn't done currently, but it seems this patch is enough. Reported as MSVR 35095. Discovered by Axel Souchet & Vishal Chauhan & Suha Can from the MSRC Vulnerabilities & Mitigations team.
* * libtiff/tif_read.c: make TIFFReadEncodedStrip() andEven Rouault2016-07-031-4/+38
| | | | | | | | | TIFFReadEncodedTile() directly use user provided buffer when no compression (and other conditions) to save a memcpy(). * libtiff/tif_write.c: make TIFFWriteEncodedStrip() and TIFFWriteEncodedTile() directly use user provided buffer when no compression to save a memcpy().
* * libtiff/tif_write.c: TIFFWriteEncodedStrip() and TIFFWriteEncodedTile()Even Rouault2015-12-121-3/+3
| | | | | | should return -1 in case of failure of tif_encodestrip() as documented * libtiff/tif_dumpmode.c: DumpModeEncode() should return 0 in case of failure so that the above mentionned functions detect the error.
* (TIFFWriteScanline): Fix Coverity 715979 "Division or modulo byBob Friesenhahn2015-06-071-1/+5
| | | | zero".
* (TIFFWriteRawStrip): Fix Coverity 715978 "Division or modulo byBob Friesenhahn2015-06-071-1/+5
| | | | zero".
* (TIFFWriteEncodedTile): Fix Coverity 715976 and 715977 "DivisionBob Friesenhahn2015-06-071-5/+14
| | | | or modulo by zero".
* * libtiff/tif_write.c (TIFFWriteEncodedStrip): Fix Coverity 715975Bob Friesenhahn2015-06-071-1/+6
| | | | | * libtiff/tif_read.c (TIFFStartTile): Fix Coverity 715973 and 715974 "Division or modulo by zero".
* avoid type cast warningsFrank Warmerdam2013-01-181-5/+5
|
* fix bug rewriting image tiles in a compressed file (gdal #4771)Frank Warmerdam2012-08-131-9/+31
|
* implement optional support for deferred strip/tile offset/size loadingFrank Warmerdam2011-02-181-1/+3
|
* * libtiff/tif_aux.c (_TIFFCheckRealloc): Improve error message soBob Friesenhahn2010-03-101-1/+8
| | | | | that it is clearly a memory allocation error message, and also includes the size of the allocation request.
* do not override planar config if set (#2057)Frank Warmerdam2009-06-031-2/+3
|
* * libtiff/tiffio.h: Undeprecate toff_t and restore its use in theBob Friesenhahn2008-12-301-2/+2
| | | | TIFFClientOpen() callback and other external function definitions.
* Keep track of TIFF_DIRTYSTRIP separately from TIFF_DIRTYDIRECT to indicateFrank Warmerdam2007-12-311-2/+11
| | | | | | | | | | | | that the strip offset/size values are dirty but nothing else about the directory is dirty. In flush handle "just stripmaps dirty" as a special case that just rewrites these values without otherwise modifying the directory on disk using TIFFRewriteField(). We also modify logic so that in update mode the directory is not marked dirty on read, but only when something is changed. This means we need to keep track of updates to the stripmap stuff in TIFFAppendToStrip().
* introduce TIFF_BUF4WRITE flag to mark rawcc buffer as for writingFrank Warmerdam2007-11-231-2/+9
|
* avoid corruption risk with write-in-same-location logicFrank Warmerdam2007-11-021-51/+40
|
* changed some more incorrect %lud printf flags to %luJoris Van Damme2007-10-011-2/+2
|
* added maximum file size overflow check to avoid writing bad classictiff > 4 gigJoris Van Damme2007-07-111-58/+65
|
* BigTIFF upgrade: type restoration - not so messy anymoreJoris Van Damme2007-06-121-16/+16
|
* BigTIFF upgrade in progress - widespread temp mess - does not compile nowJoris Van Damme2007-04-041-57/+66
|
* BigTIFF upgrade in progress - widespread temp mess - does not compile nowJoris Van Damme2007-03-311-115/+105
|
* BigTIFF upgrade in progress - widespread temp mess - does not compile nowJoris Van Damme2007-03-311-126/+128
|
* BigTIFF upgrade in progress - widespread temp mess - does not compile nowJoris Van Damme2007-03-281-10/+10
|
* clear sorted flag if we move a strip/tile - bug 1359Frank Warmerdam2006-11-201-61/+62
|
* Small code rearrangement in TIFFWriteScanline() to avoid crash as per bugAndrey Kiselev2006-02-271-15/+13
| | | | http://bugzilla.remotesensing.org/show_bug.cgi?id=1081.
* *** empty log message ***Joris Van Damme2005-12-211-16/+16
|
* Fixed setting of planar config as per bug report from Joris.Frank Warmerdam2005-10-151-2/+2
|
* Do not check the PlanarConfiguration field in the TIFFWriteCheck() function inAndrey Kiselev2005-07-211-6/+16
| | | | case of single band images (as per TIFF spec).
* Fixed wrong if() statement in TIFFAppendToStrip() function as per bugAndrey Kiselev2004-11-051-2/+3
| | | | http://bugzilla.remotesensing.org/show_bug.cgi?id=660
* Handle the zero strip/tile sizes properly (Dmitry V. Levin, Marcus Meissner).Andrey Kiselev2004-10-121-2/+2
|
* Added checks for failed memory allocations andinteger overflowsAndrey Kiselev2004-10-021-2/+5
| | | | (Dmitry V. Levin).
* Optimize checking for the strip bounds.Andrey Kiselev2004-09-261-9/+21
|
* Potential memory leak fixed in TIFFGrowStrips() (found by Dmitry V. Levin).Andrey Kiselev2004-09-251-10/+15
|
* Get rid of BSD data types (u_char, u_short, u_int, u_long).Andrey Kiselev2004-09-141-8/+10
|
* Allow in-place updating of the compressed images (don't work properly withAndrey Kiselev2004-04-141-33/+37
| | | | | all codecs). For details see GDAL bug http://bugzilla.remotesensing.org/show_bug.cgi?id=534
* Fixed reporting size of the buffer in case of stripped image inAndrey Kiselev2004-01-201-2/+2
| | | | | TIFFWriteBufferSetup(). As per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=460
* ensure byte swapping is applied on write if needed - bug 171Frank Warmerdam2003-08-051-1/+13
|
* Dont allow writing image data to preexisting compressed TIFF imagesFrank Warmerdam2003-01-311-1/+19
|
* TIFFWriteScanline() now explicitly sets the tif_row value instead of justFrank Warmerdam2002-07-311-2/+4
| | | | incrementing it, in case the codec has been fooling with it.
* TIFFCheckpointDirectory() routine added.Andrey Kiselev2002-04-091-3/+2
|
* fixed passing -1 as cc into TIFFWriteEncodedTiles()Frank Warmerdam2000-02-111-2/+2
|
* clarified some toff_t/tsize_t casting problemsFrank Warmerdam2000-01-281-2/+2
|
* BUFFERCHECK will setup the buffer if rawdata is NULL, even if the bufferFrank Warmerdam2000-01-281-4/+5
| | | | setup flag is set. TIFFWriteCheck() is now public.