summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
Commit message (Collapse)AuthorAge
* avcodec/tiff: Check for Tiled and Stripped TIFFsMichael Niedermayer2020-05-21
| | | | | | | | | | TIFF 6 spec: "Do not use both strip-oriented and tile-oriented fields in the same TIFF file." Fixes: null pointer use, crash Fixes: crash-762680f9d1b27f9b9085e12887ad44893fb2b020 Found-by: Shiziru <lunasl@protonmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: remove the unnecessary type conversionLimin Wang2020-05-08
| | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/tiff: assert that raw tiff dng blit does not write over the end of a ↵Michael Niedermayer2020-04-29
| | | | | | | | line Found-by: 黄宁 <tsukimurarin@163.com> Reviewed-by: Nick Renieris <velocityra@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Check for planar DNG imagesMichael Niedermayer2020-04-29
| | | | | | | | | | The DNG code hardcodes plane 0 at some places, so its better to disallow cases that have more planes. Fixes: eg_crash Found-by: 黄宁 <tsukimurarin@163.com> Reviewed-by: Nick Renieris <velocityra@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Replace width overriding for bayer by assertMichael Niedermayer2020-04-29
| | | | | | | This is less confusing Reviewed-by: Nick Renieris <velocityra@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Some checks on bpp for DNGMichael Niedermayer2020-04-29
| | | | | | | | | | | | dng spec 1.5.0.0 "BitsPerSample Supported values are from 8 to 32 bits/sample. The depth must be the same for each sample if SamplesPerPixel is not equal to 1." Fixes: eg_crash Found-by: 黄宁 <tsukimurarin@163.com> Reviewed-by: Nick Renieris <velocityra@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* pthread_frame: merge the functionality for normal decoder init and ↵Anton Khirnov2020-04-10
| | | | | | | | | | | | | | | | init_thread_copy The current design, where - proper init is called for the first per-thread context - first thread's private data is copied into private data for all the other threads - a "fixup" function is called for all the other threads to e.g. allocate dynamically allocated data is very fragile and hard to follow, so it is abandoned. Instead, the same init function is used to init each per-thread context. Where necessary, AVCodecInternal.is_copy can be used to differentiate between the first thread and the other ones (e.g. for decoding the extradata just once).
* tiffdec: support embedded ICC profilesLynne2020-01-13
|
* avcodec/tiff: check the black level denominatorJames Almer2019-10-29
| | | | | | | Fixes ticket #8327. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/tiff: Set FF_CODEC_CAP_INIT_CLEANUPMichael Niedermayer2019-10-03
| | | | | | | | | Fixes: memleaks Fixes: 17813/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5145600206569472 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Revert "lavc/tiff: correct the default value of YCbCrSubsampling to 2x2"Carl Eugen Hoyos2019-09-26
| | | | | | This reverts commit eb5d0f18ff609ba2280cea4e2c6286d216c8756b. Together with 89f464e9, it breaks decoding of tiff files like fate-suite/exif/image_small.tiff
* lavc/tiff: correct the default value of YCbCrSubsampling to 2x2Pavel Skakov2019-09-25
|
* avcodec/tiff: rewrite lut handlingPaul B Mahol2019-09-02
| | | | Remove endianess hack.
* avcodec/tiff: set color_trc, remove sRGB conversionPaul B Mahol2019-09-02
|
* lavc/tiff: Enable decoding of LinearRaw imagesNick Renieris2019-09-02
| | | | | | | | | | | | | "LinearRaw" is a value that the PhotometricInterpretation tag can be set to on DNG images that contain color information for all channels instead of being bayer-encoded ("CFA" value). The DNG decoder is complete enough that we can enable this now. Sample: - http://www.rawsamples.ch/raws/nikon/SCANNER_NIKON_LS5000.DNG Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Default-initialize WhiteLevel DNG tag valueNick Renieris2019-09-02
| | | | | | | | | | | Initialized to `(2 ^ BitsPerSample) - 1` as per the DNG Specification. Also make sure that `BlackLevel < WhiteLevel`. This fixes decoding for "X7 CinemaDNG" samples here: - https://www.dji.com/gr/zenmuse-x7/info#downloads Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Support DNGs with striped (non-tiled) JPEGs imagesNick Renieris2019-09-02
| | | | | | | DNG samples here can now be decoded: - https://www.photographyblog.com/previews/pentax_k1_photos Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Decode 10-bit and 14-bit DNG imagesNick Renieris2019-09-02
| | | | | | | 10-bit sample: http://www.rawsamples.ch/raws/phones/RAW_ONEPLUS_ONE-A0001.DNG 14-bit sample: https://drive.google.com/open?id=0B4JyRT3Lth5HVndyOTVOdWktM3J4TFEydTk1MnY3RWlpSzVB Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Support decoding of DNGs with single-component JPEGsNick Renieris2019-09-02
| | | | | | | | This enables decoding of DNG images generated by the 'DJI Zenmuse X7' digital camera Samples: https://www.dji.com/gr/zenmuse-x7/info#downloads Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/mjpegdec: Enable decoding of single-component bayer imagesNick Renieris2019-09-02
| | | | | | | | | Also, ensure no false positives when determining DNG bayer images, by setting them in tiff.c instead of relying on a heuristic. There's no way to determine this just from the JPEG data, so we have to pass this information from outside the MJPEG decoder. Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Force DNG pixel data endianness on an edge caseNick Renieris2019-09-02
| | | | | | | This fixes "X7 RAW" and "X7 CinemaDNG" samples here: - https://www.dji.com/gr/zenmuse-x7/info#downloads Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Don't apply strips-related logic to tiled imagesNick Renieris2019-09-02
| | | | Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Fix edge case with full-length/width tilesNick Renieris2019-09-02
| | | | | | | | | When the height is equal to the tile length (full-height tile) after `height % tile_length` is applied with the current code, it results in the operating tile_length to be 0. This commit makes this leftover logic only applies if it's necessary. Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Apply color scaling to uncompressed DNGsNick Renieris2019-09-02
| | | | Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Convert DNGs to sRGB color spaceNick Renieris2019-09-02
| | | | Signed-off-by: Nick Renieris <velocityra@gmail.com>
* lavc/tiff: Decode embedded JPEGs in DNG imagesNick Renieris2019-09-02
| | | | | | | | | | | | | | | | Used a technique similar to lavc/tdsc.c for invoking the MJPEG decoder. This commit adds support for: - DNG tiles - DNG tile huffman lossless JPEG decoding - DNG 8-bpp ("packed" as dcraw calls it) decoding - DNG color scaling [1] - LinearizationTable tag - BlackLevel tag [1]: As specified in the DNG Specification - Chapter 5 Signed-off-by: Nick Renieris <velocityra@gmail.com>
* avcodec/tiff: add missing break in tiff_decode_tag()Paul B Mahol2019-08-28
|
* avcodec/tiff: Enforce increasing offsetsMichael Niedermayer2019-08-11
| | | | | | | | | | | | | | | | | | This may break some valid tiff files, it appears the specification does not require the offsets to be increasing. They increase in the 2 test files i have though except the last offset which is 0 (an end marker) and for which a special case is added to avoid asking for a sample for that end marker. See: [FFmpeg-devel] [PATCH 2/2] avcodec/tiff: Detect infinite retry loop for an alternative implementation Fixes: Timeout (Infinite -> Finite) Fixes: 15706/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5114674904825856 This variant was requested by paul on IRC Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Recognize DNG/CinemaDNG imagesNick Renieris2019-05-30
| | | | | | | | | | | | Additionally: - Renamed TIFF_WHITE_LEVEL to DNG_WHITE_LEVEL since it is specified in the DNG spec. - Added/changed some comments to be more precise in differentiating between TIFF, TIFF/EP and DNG values. Related to ticket: https://trac.ffmpeg.org/ticket/4364 Signed-off-by: Nick Renieris <velocityra@gmail.com>
* libavcodec/tiff: Process SubIFDs tag with multiple entriesNick Renieris2019-05-30
| | | | | | | | | | | | | | | | | | | | | | | | SubIFDs that were part of more than single-sized "SubIFDs" tags were being ignored due to existing code ignoring that case. This patch makes is so the first entry is read, which is not ideal but enough for some DNG images present in the wild to be decodeable More specifically, the first SubIFD which we would process with this patch is the main image and the second one is a second thumbnail, which is not as important to decode. In DNG images with the .tiff extension, it solves the issue where the TIFF thumbnail in IFD 0 was incorrectly parsed (related confusion: [1]). Embedded thumbnails for DNG images can still be decoded with the "-thumbnail" option. Related to ticket: https://trac.ffmpeg.org/ticket/4364 [1]: https://superuser.com/questions/546879/creating-video-from-dng-images-with-ffmpeg Signed-off-by: Nick Renieris <velocityra@gmail.com>
* avcodec/tiff: Option to decode embedded thumbnailNick Renieris2019-05-30
| | | | | | | | | | Adds the "-thumbnail" option, that works like the current "-subifd" option, but only for non-full-sized images. This is particularly useful for DNG images (see next commit) that have SubIFDs that are not necessarily thumbnails. Signed-off-by: Nick Renieris <velocityra@gmail.com>
* avcodec/tiff: Multi-page supportNick Renieris2019-03-31
| | | | | | Option "-page N" (page index N starts from 1) can now be used to specify which TIFF page/subfile to decode. Signed-off-by: Nick Renieris <velocityra@gmail.com>
* avcodec/tiff: do not allow bpp 40 with undefined pixel formatsMichael Niedermayer2019-03-24
| | | | | | | | | | | | | | Fixes: Out of array access, assertion failure Fixes: 13851/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5754570929602560 Fixes: 13869/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5695998313103360 Fixes: 13873/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5077273645940736 Fixes: 13874/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5756396757319680 Fixes: 13877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5741026750234624 Fixes: 13880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5649148809838592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/tiff: Allow decoding of cmyka (five components).Carl Eugen Hoyos2019-03-20
| | | | Fixes ticket #7675.
* lavc/tiff: Support decoding 16bit cmyk.Carl Eugen Hoyos2019-03-20
|
* avcodec/tiff: Check for 12bit gray faxMichael Niedermayer2019-01-20
| | | | | | | | Fixes: Assertion failure Fixes: 11898/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5759794191794176 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/tiff: Support CMYK images.Carl Eugen Hoyos2019-01-12
| | | | Fixes ticket #3459.
* avcodec/tiff: add support for 12bit grayscale imagesPaul B Mahol2018-12-16
| | | | Fixes #4688.
* lavc/tiff: Fix leak of yuv_line in TiffContext.Carl Hetherington2018-12-11
| | | | Signed-off-by: Carl Hetherington <cth@carlh.net>
* avcodec/tiff: Fix integer overflows in left shift in init_image()Michael Niedermayer2018-11-27
| | | | | | | | Fixes: left shift of 255 by 24 places cannot be represented in type 'int' Fixes: 11377/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5694319101476864 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Limit filtering to decoded dataMichael Niedermayer2018-11-26
| | | | | | | | | Fixes: Timeout Fixes: 11068/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5698456681709568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: add initial bayer and sub image supportPaul B Mahol2018-11-12
|
* avcodec/tiff: check remaining packet size for stripsMichael Niedermayer2018-10-03
| | | | | | | | | Fixes: Timeout Fixes: 10280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5676217211027456 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: check ff_lzw_decode_open() for failurePaul B Mahol2018-09-09
|
* avcodec/tiff: Update pointer only when the result is usedMichael Niedermayer2017-06-23
| | | | | | | | Fixes: runtime error: signed integer overflow: 538976288 * 32 cannot be represented in type 'int' Fixes: 2310/clusterfuzz-testcase-minimized-4534784887881728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Fix leak of geotags[].valMichael Niedermayer2017-06-11
| | | | | | | Fixes: 2176/clusterfuzz-testcase-minimized-5908197216878592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Avoid loosing allocated geotag valuesMichael Niedermayer2017-06-05
| | | | | | | | Fixes memleak Fixes: 2076/clusterfuzz-testcase-minimized-6542640243802112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Clear deinvert_buf_size on deallocationMichael Niedermayer2017-06-04
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Use av_fast_padded_malloc() in tiff_unpack_fax()Michael Niedermayer2017-06-03
| | | | | | | | Fixes: Timeout Fixes: 1213/clusterfuzz-testcase-minimized-6022987469815808 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: reset sampling[] if its invalidMichael Niedermayer2017-05-16
| | | | | | | | Fixes divission by 0 Fixes: clusterfuzz-testcase-minimized-5592896440893440 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>