summaryrefslogtreecommitdiff
path: root/libtiff/tif_ojpeg.c
Commit message (Collapse)AuthorAgeFilesLines
* tif_ojpeg.c fix 554 by checking for division by zeroSu Laus2023-05-061-0/+3
|
* Reformatting in libtiff/ using 'pre-commit run'pre-commit run by Even Rouault2022-12-081-2320/+2518
|
* Remove vim/emacs formatting footersEven Rouault2022-12-081-9/+0
|
* Convert uses of _TIFFmalloc/realloc/calloc/free to the Ext functionsEven Rouault2022-11-231-40/+40
|
* Add reentrant error functionsLaramie Leavitt2022-11-081-68/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, libtiff relied on global error handlers, which is problematic when libtiff used by multiple independent libraries from within the same process, as they may unwittingly clobber the error handling, introduce race conditions when setting handlers, or otherwise have unintended side effects. This change adds error handlers to the TIFF struct, which are used preferentially when available. The error handlers are invoked when the re-entrant error functions are called: void TIFFErrorExtR(TIFF*, const char* module, const char* fmt, ...) void TIFFWarningExtR(TIFF*, const char* module, const char* fmt, ...) The handlers have a similar signature to the existing extended handlers, additionally returning an int: int TIFFErrorHandlerExtR(thandle_t, const char*, const char*, va_list) thandle_t is the userdata passed to TIFFOpen When the handler returns 1, the global handlers are not called. Custom error/warning handlers may be installed on a per-file basis by calling the Set functions: TIFF* tif = TIFFOpen(...); TIFFSetErrorHandlerExtR(tif, MyErrorHandler); TIFFSetWarningHandlerExtR(tif, MyWarningHandler); Additionally, the callsites to TIFFErrorExt and TIFFWarningExt have been updated to call the reentrant versions.
* OJPEG: avoid assertion when using TIFFReadScanline() (fixes #337)Even Rouault2021-12-131-0/+18
| | | | | Note: my analyis of the issue would be that the use of the scanline API is currently propably broken with OJPEG.
* libtiff: Use PRI format flags and remove unnecessary castsRoger Leigh2021-01-281-11/+11
|
* Use standard C99 integer typesRoger Leigh2021-01-211-313/+313
|
* Use stdint.h types when availableRoger Leigh2021-01-061-5/+5
|
* Fix compiler warnings about unused variables when assert() expands to nothingEven Rouault2020-10-121-0/+1
|
* Merge branch 'deprecated' into 'master'Even Rouault2020-05-091-1/+1
|\ | | | | | | | | ojpeg: s/Depreciated/Deprecated/ See merge request libtiff/libtiff!149
| * ojpeg: s/Depreciated/Deprecated/Aaron Boxer2020-05-091-1/+1
| |
* | Fix typosEven Rouault2020-04-281-1/+1
|/
* Merge branch 'issue-11-const-pointers' into 'master'Even Rouault2020-03-101-3/+3
|\ | | | | | | | | | | | | Make pointers returned via TIFFGetField const Closes #11 See merge request libtiff/libtiff!118
| * Make pointers returned via TIFFGetField constAdam Goode2020-03-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | According to http://bugzilla.maptools.org/show_bug.cgi?id=2125#c6 callers are not allowed to modify pointer or array values returned from TIFFGetField or the like. So, make this explicit in the documentation by specifying these things as const. Note that this is not an ABI change, since C does not encode const in libraries. Also, this is not really an API change, since the varargs call strips away all the types anyway. So it really is more of a documentation change. fixes #11
* | tif_ojpeg.c: relax again too strict sanity checks to allow reading of valid ↵Even Rouault2020-03-101-7/+4
|/ | | | images such as https://gitlab.com/libtiff/libtiff/-/issues/181#note_302535232. Fixes #181
* OJPEGReadHeaderInfo: if rowsperstrip not defined, then assume ↵Even Rouault2020-01-071-0/+2
| | | | one-single-strip. Complementary fix to 0356ea76bac908c61160d735f078437ace953bd3
* OJPEG: fix broken sanity check added in 4.1.0, and add two OJPEG test filesEven Rouault2019-11-111-30/+23
|
* tif_ojpeg.c: avoid relying on isTiled macro being wrapped in ()Even Rouault2019-09-021-2/+2
|
* tif_ojpeg.c: avoid use of uninitialized memory on edge/broken file. Fixes ↵Even Rouault2019-09-021-1/+7
| | | | https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16844
* tif_ojpeg.c: avoid unsigned integer overflow. Fixes ↵Even Rouault2019-08-271-1/+3
| | | | https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16793
* JPEG: avoid use of unintialized memory on corrupted filesEven Rouault2019-08-251-0/+14
| | | | | | Follow-up of cf3ce6fab894414a336546f62adc57f02590a22c Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16602 Credit to OSS Fuzz
* OJPEGWriteHeaderInfo(): avoid unsigned integer overflow on strile dimensions ↵Even Rouault2019-08-231-2/+2
| | | | close to UINT32_MAX. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16683
* tif_ojpeg: avoid unsigned integer overflow (probably not a bug). Fixes ↵Even Rouault2019-08-231-1/+2
| | | | https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16635
* OJPEGReadBufferFill(): avoid very long processing time on corrupted files. ↵Even Rouault2019-08-121-2/+7
| | | | Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16400. master only
* OJPEG: fix integer division by zero on corrupted subsampling factors. Fixes ↵Even Rouault2019-08-101-0/+6
| | | | https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15824. Credit to OSS Fuzz
* OJPEG: avoid use of unintialized memory on corrupted filesEven Rouault2019-07-051-0/+26
| | | | | Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=925269 Patch from Lei Zhang with little adaptations.
* Make defer strile offset/bytecount loading available at runtimeEven Rouault2019-05-101-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... 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.
* Remove all $Id and $Headers comments with CVS versionsEven Rouault2017-11-301-2/+0
|
* * libtiff/tif_ojpeg.c: fix potential memory leak inEven Rouault2017-04-271-1/+7
| | | | | | | OJPEGReadHeaderInfoSecTablesQTable, OJPEGReadHeaderInfoSecTablesDcTable and OJPEGReadHeaderInfoSecTablesAcTable Patch by Nicolás Peña. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2670
* * libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesQTable,Even Rouault2017-01-121-1/+7
| | | | OJPEGReadHeaderInfoSecTablesDcTable and OJPEGReadHeaderInfoSecTablesAcTable
* * libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesAcTableEven Rouault2017-01-121-1/+4
| | | | | | when read fails. Patch by Nicolás Peña. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2659
* * libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case of failure inEven Rouault2016-12-031-1/+9
| | | | | | OJPEGPreDecode(). This will avoid a divide by zero, and potential other issues. Reported by Agostino Sarubbo. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2611
* * libtiff/*.c: fix warnings raised by clang 3.9 -WcommaEven Rouault2016-09-041-6/+31
|
* * libtiff/*: upstream typo fixes (mostly contributed by Kurt Schwehr)Even Rouault2016-01-231-7/+8
| | | | coming from GDAL internal libtiff
* tif_ojpec.c: modify previous change to be compatible with all MSVC versionsEven Rouault2015-11-221-3/+8
|
* * libtiff/*.c: fix MSVC warnings related to cast shortening andEven Rouault2015-11-221-7/+9
| | | | assignment within conditional expression
* * libtiff/*.c: fix clang -Wshorten-64-to-32 warningsEven Rouault2015-11-181-6/+6
|
* * libtiff/tif_dirwrite.c (_TIFFRewriteField): Fix Coverity 1024310Bob Friesenhahn2015-05-311-2/+7
| | | | | | | "Resource leak". * libtiff/tif_ojpeg.c (OJPEGReadHeaderInfoSecStreamDht): Fix Coverity 601720 "Resource leak".
* * libtiff/tif_ojpeg.c (OJPEGReadBufferFill): Fix Coverity 603400Bob Friesenhahn2015-05-301-1/+2
| | | | "Missing break in switch".
* * libtiff/tif_getimage.c, libtiff/tif_ojpeg.c, libtiff/tif_zip.c: fixEven Rouault2014-12-251-3/+3
| | | | various typos found by Debian lintian tool (GDAL #5756)
* * libtiff/tif_lzw.c: prevent potential null dereference ofEven Rouault2014-11-201-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | sp->dec_codetab in LZWPreDecode (bug #2459) * libtiff/tif_read.c: in TIFFReadBufferSetup(), avoid passing -1 size to TIFFmalloc() if passed user buffer size is 0 (bug #2459) * libtiff/tif_ojpeg.c: make Coverity happier (not a bug, #2459) * libtiff/tif_dir.c: in _TIFFVGetField() and _TIFFVSetField(), make Coverity happier (not a bug, #2459) * libtiff/tif_dirread.c: in TIFFFetchNormalTag(), make Coverity happier (not a bug, #2459) * tools/tiff2pdf.c: close PDF file (bug #2479) * tools/fax2ps.c: check malloc()/realloc() result (bug #2470) * tools/tiffdump.c: detect cycle in TIFF directory chaining (bug #2463) and avoid passing a NULL pointer to read() if seek() failed before (bug #2459) * tools/tiffcrop.c: fix segfault if bad value passed to -Z option (bug #2459) and add missing va_end in dump_info (#2459) * tools/gif2tif.c: apply patch for CVE-2013-4243 (#2451)
* if OJPEGWriteHeader() fails once do not bother trying again on the same image.Frank Warmerdam2012-05-241-2/+4
|
* make things more resilient in the face of files without stripbytecounts or ↵Frank Warmerdam2012-05-241-1/+6
| | | | stripoffsets or where loading these fails.
* * libtiff/tif_ojpeg.c: plug leaks on OJPEG read failure pathBob Friesenhahn2011-05-311-2/+5
|
* * libtiff/tif_ojpeg.c: Fixes to compile with MinGW32 GCC.Bob Friesenhahn2011-04-021-1/+13
| | | | | | * tools/fax2ps.c (main): Use tmpfile() rather than mkstemp() since it is much more portable. Tmpfile is included in ISO/IEC 9899:1990 and the WIN32 CRT.
* fix for deferred strile loadingFrank Warmerdam2011-02-181-1/+3
|
* * libtiff/tif_ojpeg.c, libtiff/tif_pixarlog.c,Lee Howard2010-12-111-6/+6
| | | | | libtiff/tif_zip.c: fix build errors for VC6 http://bugzilla.maptools.org/show_bug.cgi?id=2105
* * libtiff/tif_ojpeg.c: fix buffer overflow on problem dataLee Howard2010-12-111-2/+6
| | | | http://bugzilla.maptools.org/show_bug.cgi?id=1999
* fix build warningLee Howard2010-12-111-2/+2
|