summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/sheervideo: Improve creating VLC tablesAndreas Rheinhardt2020-10-10
| | | | | | | | | Don't needlessly copy an array around; don't create a table with default symbols; and use smaller types to save stack space: The longest code here is 16 bits, so one can store the codes in this type. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/celp_filters: Avoid invalid negation in ff_celp_lp_synthesis_filter()Michael Niedermayer2020-10-10
| | | | | | | | Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 25675/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G729_fuzzer-4786580731199488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/takdsp: Fix negative shift in decorrelate_sf()Michael Niedermayer2020-10-10
| | | | | | | | Fixes: left shift of negative value -4 Fixes: 25723/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-6250580752990208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/parsers: add missing FF_API_NEXT wrappersJames Almer2020-10-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mpeg12dec: Optimize reading mpeg2 intra escape codesAndreas Rheinhardt2020-10-10
| | | | | | | | | | Said escape code is only six bits long, so that one has at least 25 - 6 bits in the bitstream reader's cache after reading it; therefore the whole following 18 bits (containing the actual code) are already in the bitstream reader's cache, making it unnecessary to reload the cache. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/magicyuvenc: Use more correct cast in compare functionAndreas Rheinhardt2020-10-09
| | | | | | | | There is no need to cast const away (even if it was harmless) and to copy the object at all. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/magicyuvenc: Avoid sorting Huffman table unnecessarilyAndreas Rheinhardt2020-10-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mjpegdec: Remove redundant initializationAndreas Rheinhardt2020-10-09
| | | | | | | | | Now that the correct number of codes is used, it is no longer necessary to initialize the lengths of the codes at all any more as the length of the actually used codes is set later anyway. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mjpegdec: Remove use_static from build_vlc()Andreas Rheinhardt2020-10-09
| | | | | | | | | It is always zero; it referred to the INIT_VLC_USE_STATIC flag which has been removed in 595324e143b57a52e2329eb47b84395c70f93087. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mjpegdec: Use correct number of codes when init default VLCsAndreas Rheinhardt2020-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | Commit bbc0d0c1fe2b7ecdc4367295594f084f85ad22f5 made the mjpeg decoder use default Huffman tables when none are given, yet when initializing the default Huffman tables, it did not use the correct number of entries of the arrays used to initialize the tables, but instead it used the biggest entry + 1 (as if it were a continuous array 0..biggest entry). This worked because the ff_init_vlc_sparse() (and its predecessors) always skipped entries with a length of zero and the length of the corresponding elements was always initialized to zero with only the sizes of the actually existing elements being set to a size > 0 lateron. Yet since commit 1249698e1b424cff8e77e6a83cfdbc9d11e01aa7 this is no longer so, as build_vlc() actually read the array containing the values itself. This implies that the wrong length now leads to a read beyond the end of the given array; this could lead to crashs (but usually doesn't); it is detectable by ASAN* and this commit fixes it. *: AddressSanitizer: global-buffer-overflow on address xy ... xy is located 0 bytes to the right of global variable 'avpriv_mjpeg_val_ac_luminance' Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mjpegdec: Use correct number of codes for VLC tablesAndreas Rheinhardt2020-10-08
| | | | | | | | | | | | | | | | | | Commit 1249698e1b424cff8e77e6a83cfdbc9d11e01aa7 made ff_mjpeg_decode_dht() call build_vlc() with a wrong (too hight) number of codes. The reason it worked is that the lengths of the extraneous entries is initialized to zero and ff_init_vlc_sparse() ignores codes with a length of zero. But using a too high number of codes was nevertheless bad, because a) the assert in build_vlc() could have been triggered (namely if the real amount of codes is 256) and b) the loop in build_vlc() uses initialized data (leading to Valgrind errors [1]). Furthermore, the old code spend CPU cycles in said loop although the result won't be used anyway. [1]: http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-valgrind&time=20201008025137 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* VP9 Profile 2 VDPAU supportManojGuptaBonda2020-10-08
| | | | | | | Added VDPAU to list of supported formats for VP9 420 10 and 12 bit formats. Add VP9 10/12 Bit support for VDPAU Signed-off-by: Philip Langdale <philipl@overt.org>
* avcodec/mjpegdec: improve decoding of DNG filesPaul B Mahol2020-10-07
| | | | That have unused symbols coded in DHT.
* avcodec/tiff: do not abort decoding if strips are availablePaul B Mahol2020-10-07
| | | | | | Even if such files are invalid, they can be decoded just fine. Also stored tiles may have bigger dimensions than displayed ones, so do not abort decoding in such cases.
* avcodec: add Cintel RAW decoderPaul B Mahol2020-10-07
|
* avcodec/av1dec: avoid probing with av1decJames Almer2020-10-06
| | | | | | | | av1dec should no longer attempt to output empty frames if another decoder was used for probing and it sucessfully set a pix_fmt ever since 05872c67a4, so we can re-add the AV_CODEC_CAP_AVOID_PROBING cap. Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/avs2_parser.c: optimize code stylehwren2020-10-06
| | | | Signed-off-by: hwren <hwrenx@126.com>
* lavc/avs2_parser.c,lavf/davs2.c: add AVS2_* prefixhwren2020-10-06
| | | | | | Add AVS2_* prefix to macro definitions to avoid confusion Signed-off-by: hwren <hwrenx@126.com>
* lavc,doc: add libuavs3d video decoder wrapperhwren2020-10-06
| | | | | Signed-off-by: hbj <hanbj@pku.edu.cn> Signed-off-by: hwren <hwrenx@126.com>
* lavc/avs3_parser: add avs3 parserhwren2020-10-05
| | | | | Signed-off-by: hbj <hanbj@pku.edu.cn> Signed-off-by: hwren <hwrenx@126.com>
* lavc/avs3.h: add AVS3 related definitionshwren2020-10-05
| | | | Signed-off-by: hwren <hwrenx@126.com>
* lavc: add AVS3 codec id and deschwren2020-10-05
| | | | | Signed-off-by: hbj <hanbj@pku.edu.cn> Signed-off-by: hwren <hwrenx@126.com>
* avcodec/h264_slice: use av_buffer_replace() to simplify codeJames Almer2020-10-05
| | | | | | | Based on eff289ce9f030f023e218ee7ce354d4f0e035b6d. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/qsv: Fix leak of options on errorAndreas Rheinhardt2020-10-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dvenc: Fix undefined left shift of negative numbersAndreas Rheinhardt2020-10-04
| | | | | | | | | The earlier code was based on the assumption that AVFrame.linesize can not be negative. Fixes ticket #8280. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dxtory: Fix negative stride shift in dx2_decode_slice_420()Michael Niedermayer2020-10-04
| | | | | | | | | Fixes: left shift of negative value -640 Fixes: 26044/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXTORY_fuzzer-5631057602543616 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/av1dec: partially clean state on frame decoding errorsJames Almer2020-10-04
| | | | | | | | Fixes: member access within null pointer of type 'TileGroupInfo' (aka 'struct TileGroupInfo') Fixes: 25725/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5166692706287616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: James Almer <jamrial@gmail.com>
* libwavpackenc: remove libwavpackenc wrapperLynne2020-10-02
| | | | | | | | | The manual states "there is virtually no reason to use that encoder.". It supports less sample formats than the native encoder, is less efficient than the native encoder and is also slower and pretty much remains untested. libwavpack also isn't being fuzzed, which given that we plug the parameters without any sanitizing them looks concerning.
* avcodec/vc1_block: Fix integer overflow in ac valueMichael Niedermayer2020-10-02
| | | | | | | | Fixes: signed integer overflow: 25488 * 87381 cannot be represented in type 'int' Fixes: 24765/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5108259565076480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: add missing FF_API_TAG_STRING checkJames Almer2020-10-01
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/options: add missing FF_API_COPY_CONTEXT checksJames Almer2020-10-01
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/libvpxenc: add missing FF_API_ERROR_FRAME checkJames Almer2020-10-01
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: avoid copy of uninitialized extradata pointerTimo Rothenpieler2020-10-01
|
* avcodec/cuviddec: use correct type for extradata_sizeTimo Rothenpieler2020-10-01
|
* avcodec/cuviddec: fix copy&paste errorTimo Rothenpieler2020-10-01
|
* avcodec/utils: ReindentationAndreas Rheinhardt2020-10-01
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Also free encoder extradata on avcodec_open2() errorAndreas Rheinhardt2020-10-01
| | | | | | It is owned by libavcodec for encoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Don't forget cleaning up when allocating priv_data failsAndreas Rheinhardt2020-10-01
| | | | | | | | | Allocating an AVCodecContext's priv_data used to be the first object allocated in avcodec_open2(), so it was unnecessary to goto free_and_end (which does the cleanup) upon error here. But this is no longer so since f3a29b750a5979ae6847879fba758faf1fae88d0. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Improve check for freeing codec private optionsAndreas Rheinhardt2020-10-01
| | | | | | | | | | Don't check for AVCodec.priv_data_size (which is always true if AVCodec.priv_class is set). Instead check for AVCodecContext.priv_data to actually exist. (Note: av_opt_free(NULL) is a no-op.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Remove always-true checkAndreas Rheinhardt2020-10-01
| | | | | | | | | | | | The first thing avcodec_open2() allocates is the AVCodecInternal. If allocating it fails, a jump to end occurs; but if an error happens after its allocation, a jump to free_and_end happens which frees all allocations performed so far and then jumps to end. Yet free_and_end contained a check for AVCodecInternal (after having already dereferenced it to check whether ff_thread_free() needs to be called) which is of course always true. So remove it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* opusdec: do not fail when LBRR frames are presentAnton Khirnov2020-10-01
| | | | | | Decode and discard them. Fixes ticket 4641.
* avcodec/av1dec: call ff_cbs_flush() on decoder flushJames Almer2020-09-29
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: fix check for active sequence headerJames Almer2020-09-29
| | | | | | We clear the AV1RawSequenceHeader pointer on flush, not the relevant AVBufferRef. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: parse dimensions from the sequence header in extradataJames Almer2020-09-29
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_vp9: implement a CodedBitstreamType.flush() callbackJames Almer2020-09-29
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_h2645: implement CodedBitstreamType.flush() callbacksJames Almer2020-09-29
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_av1: implement a CodedBitstreamType.flush() callbackJames Almer2020-09-29
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs: add a flush callback to CodedBitstreamTypeJames Almer2020-09-29
| | | | | | Used to reset the codec's private internal state. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: handle arbitrarily sized extradataTimo Rothenpieler2020-09-29
|
* avcodec/utils: Only call codec->close if init has been calledAndreas Rheinhardt2020-09-29
| | | | | | | | | | | | | | | | | | | | avcodec_open2() also called the AVCodec's close function if an error happened before init had ever been called if the AVCodec has the FF_CODEC_CAP_INIT_CLEANUP flag set. This is against the documentation of said flag: "The codec allows calling the close function for deallocation even if the init function returned a failure." E.g. the SVQ3 decoder is not ready to be closed if init has never been called. Fixes: NULL dereference Fixes: 25762/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5716279070294016 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>