summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/cbs_h265_syntax_template: Check num_negative/positive_pics when ↵Michael Niedermayer2020-04-26
| | | | | | | | | | inter_ref_pic_set_prediction_flag is set Fixes: out of array access Fixes: 20446/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-5707770718584832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/intrax8: Check for end of bitstream in ff_intrax8_decode_picture()Michael Niedermayer2020-04-26
| | | | | | | | Fixes: Timeout (105sec -> 1sec) Fixes: 20479/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5769846937878528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32/16bit()Michael Niedermayer2020-04-25
| | | | | | | | | | | Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int32_t' (aka 'int') Fixes: 21245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5683334274613248 Change to int16_t suggested by Lynne Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/bsf: simplify the codeLimin Wang2020-04-25
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/vp9: prevent null pointer use on init_frames() failurePeter Ross2020-04-25
| | | | | Signed-off-by: Peter Ross <pross@xvid.org> Reviewed-by: James Almer <jamrial@gmail.com>
* avcodec: add support for Cunning Developments' ADPCMZane van Iperen2020-04-24
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mjpeg2jpeg_bsf: Remove unnecessary headerAndreas Rheinhardt2020-04-24
| | | | | | | | | | libavutil/mem.h is unneeded since 33d18982fa03feb061c8f744a4f0a9175c1f63ab, the commit that introduced the new packet-based bsf API, because with this switch the allocations were no longer performed directly, but by av_new_packet(). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/noise_bsf: Remove unnecessary headersAndreas Rheinhardt2020-04-24
| | | | | | | | | | | | | | | With 33d18982fa03feb061c8f744a4f0a9175c1f63ab, the commit introducing the new packet-based bsf API, a new buffer was no longer allocated directly, but via av_new_packet(), so that libavutil/mem.h was no longer needed. Moreover since commit dc99ee6b08e54de13b4c82ff265609b6ab83e3d8 av_packet_make_writable() is employed which copies the data in case it is unavoidable so that string.h is no longer used (it was used for memcpy()). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dump_extradata_bsf: Remove unnecessary headerAndreas Rheinhardt2020-04-24
| | | | | | | | | | Since 33d18982fa03feb061c8f744a4f0a9175c1f63ab (the commit that introduced the new bsf API) allocating an enlarged buffer in case extradata needs to be added to a packet is done via av_new_packet(), so that libavutil/mem.h is no longer needed. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dca_core_bsf: Remove unnecessary headerAndreas Rheinhardt2020-04-24
| | | | | | | This bsf never needed libavutil/mem.h. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/chomp_bsf: Remove unnecessary headerAndreas Rheinhardt2020-04-24
| | | | | | | This bsf never needed internal.h. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp9_raw_reorder_bsf: Remove unnecessary headerAndreas Rheinhardt2020-04-24
| | | | | | | | | This bsf doesn't have any options, so including libavutil/opt.h is unnecessary. Reviewed-by: Peter Ross <pross@xvid.org> Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavcodec/avpacket: Don't simply forward return value of av_dict_set()Andreas Rheinhardt2020-04-23
| | | | | | | | | | | The documentation of av_dict_set() states that values >= 0 indicate success, whereas av_packet_unpack_dictionary() implies that return values > 0 are impossible. So only forward the return value of av_dict_set() in av_packet_unpack_dictionary() on error. (Btw: av_dict_set() does currently not return values > 0.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/hevc_mp4toannexb_bsf: Check nalu_sizeMichael Niedermayer2020-04-23
| | | | | | | | Fixes: Timeout (29sec -> 5ms) Fixes: 20237/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_MP4TOANNEXB_fuzzer-5165615044362240 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/jpeg2000dec.c: ROI marker supportGautam Ramakrishnan2020-04-23
| | | | | | | | | This patch adds support for decoding images with a Region of Interest. Allows decoding samples such as p0_03.j2k. This patch should fix ticket #4681. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/version: bump minor version for DOVI sidedataJun Zhao2020-04-23
| | | | Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavc: add a new sidedata type for DOVIJun Zhao2020-04-23
| | | | | | add a new sidedata type for DOVI. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* mpeg4videoenc: Don't crash with -fsanitize=boundsVitaly Buka2020-04-22
| | | | | | Also the patch makes this code consistent with mpeg4videodec.c Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/jpeg2000dec.c: Support for CRG markerGautam Ramakrishnan2020-04-22
| | | | | | | | This patch adds support to skip the CRG marker. The CRG marker, is an informational marker. Allows samples such as p0_03.j2k to be decoded. 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/pngdec: Pass ret from decode_iccp_chunk()Michael Niedermayer2020-04-20
| | | | | | | Found while reviewing a patch fixing a similar issue Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcm: update get_nb_samples() docZane van Iperen2020-04-20
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcm_ima_{apc, ssi, oki}: replace while() with for()Zane van Iperen2020-04-20
| | | | | | | Per discussion at https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/260854.html Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/qpeg: mark the init function as thread-safe and init cleanup capableJames Almer2020-04-20
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/qpeg: export missing frame propertiesJames Almer2020-04-20
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/qpeg: remove an unnecessary intermediary AVFrameJames Almer2020-04-20
| | | | | | | | | Decoding can be handled directly in the output frame. Also ensure flushing cleans the reference frame in all cases. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: Use macro for "packet is empty"Andreas Rheinhardt2020-04-20
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavc: stop using deprecated av_codec_next()Josh de Kock2020-04-20
| | | | Signed-off-by: Josh de Kock <josh@itanimul.li>
* lavc/hevcdec: fix the HEVC decoder crash when memory over-readqoroliang2020-04-20
| | | | | | | | | | | | Fix an occasional crash for hevc decoder in ARM 32 platform, the root cause is the memory over read(read cross the memory boundary) in SAO NENO functions ff_hevc_sao_band_filter_neon_8 and ff_hevc_sao_edge_filter_neon_8. After this fix, the crash disapper in the massive Android phone test. Signed-off-by: qoroliang <qoroliang@tencent.com>
* avcodec/truehd_core_bsf: Remove unused AVClass pointerAndreas Rheinhardt2020-04-19
| | | | | | | | The context structure of the truehd_core bsf had a pointer to a const AVClass as its first member; yet this bsf does not have any AVClass associated with it, so that this pointer is always NULL. So remove it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rv40dsp: Fix integer overflows in rv40_weight_func_*()Michael Niedermayer2020-04-19
| | | | | | | | Fixes: signed integer overflow: 40550400 * 128 cannot be represented in type 'int' Fixes: 20331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV40_fuzzer-5676685725007872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pngdec: set return value on av_stereo3d_create_side_data() failurePeter Ross2020-04-18
| | | | | Signed-off-by: Peter Ross <pross@xvid.org> Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* avcodec/bsf: use simplified algorithm for bsf_list chained filteringMarton Balint2020-04-17
| | | | | | Based on the one in ffmpeg.c and it is not using an extra flush_idx variable. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/mv30: use aandcttablesPeter Ross2020-04-17
|
* avcodec/mv30: remove unused table elementsPeter Ross2020-04-17
|
* avcodec/vp3: fix indentationPeter Ross2020-04-17
|
* avcodec: add a WebP parserJames Almer2020-04-16
| | | | | | | | | Based on code from the BMP parser. Addresses ticket #8574 Reviewed-by: James Zern <jzern@google.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dec_fixed: Fix several invalid left shifts in scale_coefs()Michael Niedermayer2020-04-16
| | | | | | | | Fixes: left shift of negative value -14336 Fixes: 20298/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5675484201615360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/flac_parser: Do not lose header count in find_headers_search()Michael Niedermayer2020-04-16
| | | | | | | | | | Fixes: Timeout Fixes: out of array access Fixes: 20274/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5649631988154368 Fixes: 19275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5757535722405888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/audiodsp: Fix integer overflow in scalarproduct_int16_c()Michael Niedermayer2020-04-16
| | | | | | | | Fixes: signed integer overflow: 2145417478 + 76702564 cannot be represented in type 'int' Fixes: 20313/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RA_144_fuzzer-5734487724130304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: Add explicit capability flag for encoder flushingPhilip Langdale2020-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, there was no way to flush an encoder such that after draining, the encoder could be used again. We generally suggested that clients teardown and replace the encoder instance in these situations. However, for at least some hardware encoders, the cost of this tear down/replace cycle is very high, which can get in the way of some use-cases - for example: segmented encoding with nvenc. To help address that use case, we added support for calling avcodec_flush_buffers() to nvenc and things worked in practice, although it was not clearly documented as to whether this should work or not. There was only one previous example of an encoder implementing the flush callback (audiotoolboxenc) and it's unclear if that was intentional or not. However, it was clear that calling avocdec_flush_buffers() on any other encoder would leave the encoder in an undefined state, and that's not great. As part of cleaning this up, this change introduces a formal capability flag for encoders that support flushing and ensures a flush call is a no-op for any other encoder. This allows client code to check if it is meaningful to call flush on an encoder before actually doing it. I have not attempted to separate the steps taken inside avcodec_flush_buffers() because it's not doing anything that's wrong for an encoder. But I did add a sanity check to reject attempts to flush a frame threaded encoder because I couldn't wrap my head around whether that code path was actually safe or not. As this combination doesn't exist today, we'll deal with it if it ever comes up.
* lavc/jpeg2000dec: Cosmetics, re-indent after last commit.Carl Eugen Hoyos2020-04-15
|
* lavc/jpeg2000dec: Allow to force a compatible pix_fmt.Carl Eugen Hoyos2020-04-15
| | | | | This copies the behaviour of the libopenjpeg decoder. Fixes ticket #5919.
* avcodec/cbs_jpeg_syntax_template: Check array index in huffman_table()Michael Niedermayer2020-04-15
| | | | | | | | Fixes: index 224 out of bounds for type 'uint8_t [224]' Fixes: 21534/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-6291612167831552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/cbs_jpeg_syntax_template: Check table index before use in dht()Michael Niedermayer2020-04-15
| | | | | | | | Fixes: out of array access Fixes: 21515/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5766121576988672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leakMatthieu Bouron2020-04-15
| | | | | | Fixes ticket #8607. Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/v4l2_m2m: handle v4l2 end of stream eventMing Qian2020-04-14
| | | | | | | | | | | | | | When flushing the capture buffers, the driver may send a V4L2_EVENT_EOS to notify that draining is completed. Currently, v4l2_m2m does not subscribe to this event, which can cause some devices (i.e. imx8qm) to hang at the end of encoding/decoding. Support for handling the event is added in this commit. Some devices may not signal V4L2_EVENT_EOS. This is logged as a warning message during initialization and not treated as a fatal error. Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* lavc/vaapi_decode: fix the build failure when hevc_vaapi is disabledLinjie Fu2020-04-13
| | | | | | | | | Verified with ./configure --enable-vaapi --disable-hwaccel=hevc_vaapi Failure reported in: http://fate.ffmpeg.org/report.cgi?time=20200401135031&slot=x86_64-archlinux-gcc-random Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* avcodec/cbs: Avoid leaving the ... out in calls to variadic macrosAndreas Rheinhardt2020-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to C99, there has to be at least one argument for every ... in a variadic function-like macro. In practice most (all?) compilers also allow to leave it completely out, but it is nevertheless required: In a variadic macro "there shall be more arguments in the invocation than there are parameters in the macro definition (excluding the ...)." (C99, 6.10.3.4). CBS (not the framework itself, but the macros used in the cbs_*_syntax_template.c files) relies on the compiler allowing to leave a variadic macro argument out. This leads to warnings when compiling in -pedantic mode, e.g. "warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]" from Clang. Most of these warnings can be easily avoided: The syntax_templates mostly contain helper macros that expand to more complex variadic macros and these helper macros often omit an argument for the .... Modifying them to always expand to complex macros with an empty argument for the ... at the end fixes most of these warnings: The number of warnings went down from 400 to 0 for cbs_av1, from 1114 to 32 for cbs_h2645, from 38 to 0 for cbs_jpeg, from 166 to 0 for cbs_mpeg2 and from 110 to 8 for cbs_vp9. These eight remaining warnings for cbs_vp9 have been fixed by switching to another macro in cbs_vp9_syntax_template: The fixed values for the sync bytes as well as the trailing bits for byte-alignment are now read via the fixed() macro (this also adds a check to ensure that trailing bits are indeed zero as they have to be). Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>