summaryrefslogtreecommitdiff
path: root/libavcodec/iff.c
Commit message (Collapse)AuthorAge
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/iff: Remove redundant #ifAndreas Rheinhardt2022-05-30
| | | | | | | | Since ec0275843d8eb933699807da81f6f366291f034a this file is compiled iff the IFF ILBM decoder is enabled. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-05
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-05
| | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVFrame *frame = data;" line for non-subtitle decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-21
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-21
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/iff: limit written bytes to twice the output array size in ↵Michael Niedermayer2021-11-29
| | | | | | | | | | decode_delta_l() Fixes: Timeout Fixes: 39436/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6624915520880640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Only write palette to plane 1 if its PAL8Michael Niedermayer2021-06-18
| | | | | | | | Fixes: null pointer passed as argument 1, which is declared to never be null Fixes: 33791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5107575256383488.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-02
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/iff: Reorder checks to avoid unnecessary alloc+freeAndreas Rheinhardt2021-05-02
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/iff: Fix off by x errorMichael Niedermayer2020-06-14
| | | | | | | | Fixes: out of array access Fixes: 23245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723121327013888.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Test video_size being non zeroMichael Niedermayer2020-05-12
| | | | | | | | | Fixes: Out of array access Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5658548592967680 Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723561177382912 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Fix several integer overflowsMichael Niedermayer2020-05-11
| | | | | | | | | Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int32_t' (aka 'int') Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5764066459254784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Check length before memcpy() in decode_deep_rle32()Michael Niedermayer2020-04-22
| | | | | | | | Fixes: out of array read Fixes: 20796/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5111364702175232.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Fix invalid pointer intermediates in decode_deep_rle32()Michael Niedermayer2020-04-22
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Over-allocate ham_palbuf for HAM6 IFF-PBMMichael Niedermayer2020-01-30
| | | | | | | | | IFF-PBM-HAM6 can read out of array without this overallocation Fixes: Out of array read Fixes: 19752/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5675331403120640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Check input space before loop in decode_delta_d()Michael Niedermayer2020-01-18
| | | | | | | | Fixes: Timeout (114sec ->108ms) Fixes: 19290/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5740598116220928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Check that video_size is large enough for the read parametersMichael Niedermayer2019-12-28
| | | | | | | | | | | video is allocated before parameters like bpp are read. Fixes: out of array access Fixes: 19084/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5718556033679360 Fixes: 19465/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5759908398235648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Skip overflowing runs in decode_delta_d()Michael Niedermayer2019-12-15
| | | | | | | | Fixes: Timeout (107sec - 75ms> Fixes: 18812/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6295585225441280 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Move index use after check in decodeplane8()Michael Niedermayer2019-11-20
| | | | | | | | | Fixes: index 9 out of bounds for type 'const uint64_t [8][256]' Fixes: 18409/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5767030560522240 Fixes: 18720/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5651995784642560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Check available space before entering loop in ↵Michael Niedermayer2019-11-09
| | | | | | | | | | decode_long_vertical_delta2() / decode_long_vertical_delta() Fixes: Timeout (31sec -> 41ms) Fixes: 18380/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5645210121404416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Check for overlap in cmap_read_palette()Michael Niedermayer2019-09-05
| | | | | | | | Fixes: undefined memcpy() use Fixes: 16302/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5678750575886336 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/iff: Use unsigned to avoid undefined behaviourAndreas Rheinhardt2019-08-05
| | | | | | | | | | | The initialization of the uint32_t plane32_lut matrix uses left shifts of the form 1 << plane; plane can be as big as 31 which means that this is undefined behaviour as 1 will be simply an int. So make it unsigned to avoid this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Add "else" to make code look prettierMichael Niedermayer2019-07-14
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Check ham vs bppMichael Niedermayer2019-07-08
| | | | | | | | | | | | This checks the ham value much stricter and avoids hitting cases which cannot be reached with data from the libavformat demuxer. Fixes: out of array access Fixes: 15320/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5080476840099840 Fixes: 15423/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5630765833912320 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: finetune the palette size check in the mask caseMichael Niedermayer2019-06-23
| | | | | | | | | Fixes: out of array access Fixes: 15381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5668057826983936 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Fix mask_buf / mask_palbuf leakMichael Niedermayer2019-06-23
| | | | | | | | Fixes: 15372/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5708881759567872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Cleanup on init failureMichael Niedermayer2017-06-18
| | | | | | | | Fixes: memleak Fixes: 2272/clusterfuzz-testcase-minimized-5059103858622464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* avcodec/iff: support for byterun1 ACBM compressionPaul B Mahol2017-02-12
| | | | | | This is apparently same as no compression. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/iff: add support for vertical word compression in ILBMPaul B Mahol2017-01-06
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/iff: remove palette swapping for animPaul B Mahol2016-08-15
| | | | It appears it is wrong.
* avcodec/iff: Check that there are enough bytes in dgb before readingMichael Niedermayer2016-07-11
| | | | | | Fixes CID1361959 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: remove useless ()Michael Niedermayer2016-07-11
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Print error for cols/bpp/bytes being bad in decode_delta_j()Michael Niedermayer2016-07-06
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: decode_delta_j: Check that the number of bytes that will be ↵Michael Niedermayer2016-07-06
| | | | | | | | | read are available This should avoid long loops related to CID1361958 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '5c31eaa9998b2185e0aa04d11adff128498dc14a'Clément Bœsch2016-06-21
|\ | | | | | | | | | | | | * commit '5c31eaa9998b2185e0aa04d11adff128498dc14a': Remove unnecessary get_bits.h #includes and add missing headers where needed. Merged-by: Clément Bœsch <clement@stupeflix.com>
| * Remove unnecessary get_bits.h #includes and add missing headers where needed.Alexandra Hájková2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/iff: Fix bytestream advanceMichael Niedermayer2016-06-12
| | | | | | | | | | | | Fixes Ticket5585 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/iff: mention RGB8/RGBN decoderPiotr Bandurski2016-05-22
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/iff: add support for ANBR filesPaul B Mahol2016-05-19
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/iff: add forgotten checks for end of input bufferPaul B Mahol2016-05-18
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/iff: scala anim32 & anim16 decompressionPaul B Mahol2016-05-18
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/iff: fix artifacts with uncompressed ham ANIMsPaul B Mahol2016-05-17
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/iff: add support for ANIMs with keyframes and concatenated ANIMsPaul B Mahol2016-05-16
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/iff: check if there is enough bytes leftPaul B Mahol2016-05-16
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/iff: rewrite out of bounds checking in writerPaul B Mahol2016-05-15
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/iff: check for end of buffer in input for delta_l decompressionPaul B Mahol2016-05-14
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>