Commit Graph

99673 Commits

Author SHA1 Message Date
Andreas Rheinhardt 38cdd27e9b avcodec/movtextdec: Fix leaks of strings upon reallocation failure
Up until now, the 3GPP Timed Text decoder used av_dynarray_add()
for a list of font entries, a structure which contains an allocated
string. The font entries are owned by the pointers in the dynamic array
and are therefore unsuitable for av_dynarray_add() which simply frees
the array, but not the font entries and of course not the strings. The
latter all leak if reallocating the dynamic array fails.

This commit fixes this. It stops reallocating the array altogether:
After all, the final number of elements (pending errors) is already
known in advance.

Furthermore, the font entries are now the entries of the new array,
i.e. the font entries are no longer allocated separately. This also
removes one level of indirection.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-19 04:52:48 +02:00
Andreas Rheinhardt 5758620560 avcodec/movtextdec: Reset counter of fonts when freeing them
If allocating fonts fails when reading the header, all fonts are freed,
yet the counter of fonts is not reset and no error is returned; when
subtitles are decoded lateron, the inexistent list of fonts is searched
for the matching font for this particular entry which of course leads to
a segfault.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-19 04:49:57 +02:00
Paul B Mahol 9860777516 avfilter/af_aiir: remove unused variable 2020-10-18 22:56:23 +02:00
Michael Niedermayer 4f83a53638 avcodec/aacdec_fixed: Limit index in vector_pow43()
Fixes: out of array access
Fixes: 26087/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5724825462767616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 21:27:23 +02:00
Michael Niedermayer 7ac87a2c34 avformat/kvag: Fix integer overflow in bitrate computation
Fixes: signed integer overflow: 1077952576 * 4 cannot be represented in type 'int'
Fixes: 26152/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5674758518341632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 21:27:23 +02:00
Michael Niedermayer 182d7a7427 avcodec/h264_slice: fix undefined integer overflow with POC in error concealment
Alternatively the POC could be changed to 64bit. the large values seem to be within what is allowed.

Fixes: signed integer overflow: 2147483646 + 2 cannot be represented in type 'int'
Fixes: 26076/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711127201447936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 21:27:23 +02:00
Michael Niedermayer cc072f7353 avcodec/decode: Consider discarded samples in max_samples
Fixes: Timeout (several minutes -> 3 sec)
Fixes: 25246/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5943400661254144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 21:27:23 +02:00
Michael Niedermayer c0c6b68ddb tools/target_dec_fuzzer: assume that discarded audio packets produced max samples
We do not know how many samples these produce as its not exported.
Alternatively we could export that but as long as its not we better
assume its more than 0 as otherwise the thresholds would not work

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 21:27:23 +02:00
Michael Niedermayer c062dd74d7 tools/target_dec_fuzzer: Correct maxsamples_per_frame if maxsamples has been changed
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 21:27:23 +02:00
Michael Niedermayer ee33fecb62 avcodec/mpeg12dec: Limit maximum A53 CC size
This is more than 10 times the size of the largest i found. And also alot more
than our encoder could handle (our encoder is limited to max 31)
Without any limit megabyte+ sized blocks can be reallocated millions of times.
Sadly the SCTE-20 spec does not seem to contain any hard limit directly, so this limit here
is arbitrary

Fixes: Timeout (25sec -> 152ms)
Fixes: 25714/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-5713633336885248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 20:42:21 +02:00
Michael Niedermayer 34df97b088 avcodec/photocd: Use ff_set_dimensions()
Fixes: out of memory
Fixes: 25588/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PHOTOCD_fuzzer-6612945080156160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 20:42:21 +02:00
Michael Niedermayer 3162482a14 avformat/ape: Remove seektable and bittable
Suggested-by: Andreas
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 20:42:20 +02:00
Michael Niedermayer aee8477c6b avformat/rmdec: sanity check coded_framesize
Fixes: signed integer overflow: -14671840 * 8224 cannot be represented in type 'int'
Fixes: 24793/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5101884323659776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-18 20:42:20 +02:00
Paul B Mahol 847dc03787 avfilter/af_aiir: add analog transfer function format 2020-10-18 18:48:41 +02:00
Andreas Rheinhardt 6ef55f54fe avfilter/af_mcompand: Remove redundant calls to AVFilter.uninit
uninit is already called automatically (even when configuring the filter
failed).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-18 15:30:03 +02:00
Andreas Rheinhardt 746ab8327c avcodec/asvenc: Avoid reversing output data twice
The ASUS V2 format is designed for a little-endian bitstream reader, yet
our encoder used an ordinary big-endian bitstream writer to write it;
the bits of every byte were swapped at the end and some data (namely the
numbers not in static tables) had to be bitreversed before writing it at
all, so that it would be reversed twice.

This commit stops doing so; instead, a little-endian bitstream writer is
used. This also necessitated to switch certain static tables, which
required trivial modifications to the decoder (that uses the same
tables).

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-18 15:29:34 +02:00
Andreas Rheinhardt c9e8f03195 avcodec/asvenc: Simplify flushing and padding packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-18 14:46:28 +02:00
Andreas Rheinhardt cdf7619705 avcodec/asvdec: Avoid reversing input data twice
Up until now the ASV2 decoder used an ordinary big-endian bitreader to
read data actually destined for a little-endian bitreader; this is done
by reversing the whole input packet bitwise, using the big-endian
bigreader and reversing (and shifting) the result again. This commit
stops this and instead uses a little-endian bitreader directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-18 14:46:28 +02:00
Timo Rothenpieler 62073cfa97 avcodec/nvenc: update driver versions for SDK 11.0 2020-10-17 23:10:42 +02:00
Paul B Mahol f372ce35f2 avfilter/af_aiir: use av_sscanf() 2020-10-17 18:43:47 +02:00
Paul B Mahol 7c1eef48e1 avfilter/af_aiir: reverse order of biquads in serial processing
This avoids most of clippings for fixed-point precision inputs.
Also add warning about filtering fixed-point precision with parallel processing.
2020-10-17 18:43:47 +02:00
Michael Niedermayer 33624f4f2e avformat/flvdec: Check for EOF in amf_parse_object()
Fixes: Timeout (too long -> 1ms)
Fixes: 26108/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5653887668977664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Michael Niedermayer 77cdc68479 avcodec/mv30: Fix multiple integer overflows
Fixes: signed integer overflow: -895002 * 2400 cannot be represented in type 'int'
Fixes: 26052/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5431812577558528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Michael Niedermayer 42ded4d1e6 avcodec/smacker: Check remaining bits in SMK_BLK_FULL
Fixes: out of array access
Fixes: 26047/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5083031667474432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Michael Niedermayer 5a2a7604da avcodec/cook: Check subpacket index against max
Fixes: off by 1 error
Fixes: index 5 out of bounds for type 'COOKSubpacket [5]'
Fixes: 25772/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5762459498184704.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Michael Niedermayer 01bb12f883 avcodec/utils: Check for overflow with ATRAC* in get_audio_frame_duration()
Fixes: signed integer overflow: 1024 * 13129048 cannot be represented in type 'int'
Fixes: 26378/clusterfuzz-testcase-minimized-ffmpeg_dem_CODEC2RAW_fuzzer-5634018353348608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Michael Niedermayer 3fbf873792 avcodec/hevcpred_template: Fix diagonal chroma availability in 4:2:2 edge case in intra_pred
Fixes: pixel decode issue.ts
Fixes: raw frame.hevc

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Michael Niedermayer 060e1ad69d avcodec/hevc_mvs: Cleanup ff_hevc_set_neighbour_available()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Michael Niedermayer 3300f5c133 avformat/icodec: Change order of operations to avoid NULL dereference
Fixes: SEGV on unknown address 0x000000000000
Fixes: 26379/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-5709011753893888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-17 14:36:11 +02:00
Jan Ekström 86228ebdb2 ffmpeg: deduplicate init_output_stream usage logic
Adds a wrapper function, which handles any errors depending on how
fatal a failure would be.
2020-10-17 11:55:55 +03:00
Zane van Iperen bf4a253f38
avcodec/adpcmenc: remove BLKSIZE #define
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:07 +10:00
Zane van Iperen e368be5230
avcodec/adpcm_ima_wav: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:06 +10:00
Zane van Iperen ed1cfb8e31
avcodec/adpcm_yamaha: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:06 +10:00
Zane van Iperen eb75a80dc8
avcodec/adpcm_ima_apm: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:06 +10:00
Zane van Iperen b5c2c9a1ce
avcodec/adpcm_ima_ssi: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:05 +10:00
Zane van Iperen bd1c94bb68
avcodec/adpcm_ms: support custom block size for encoding
Fixes tickets #6585 and #7109

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:05 +10:00
Zane van Iperen c78c60c3e8
avcodec/adpcmenc: add "block_size" option
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:02 +10:00
Brad Hards fcec7a6848 avformat/mpegts: replace magic descriptor_tag values with defines
This takes the used values from ISO/IEC 13818-1 Table 2-45 and adds
them to the mpegts.h header. No functional changes.

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-16 23:31:45 +02:00
Zhao Zhili 15a74d21f3 avformat/udp: remove redundant setting of h->max_packet_size
h->max_packet_size is being reset in the following code.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-16 23:16:55 +02:00
Marton Balint f076a5fef6 Revert "aviobuf: Discard old buffered, previously read data in ffio_read_partial"
This is unneeded after 2ca48e4666 and it breaks
ffio_ensure_seekback().

This reverts commit 53c25ee073.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-16 23:16:46 +02:00
Marton Balint fb0304fcc9 avformat/libsrt: fix cleanups on failed libsrt_open() and libsrt_setup()
- Call srt_epoll_release() to avoid fd leak on libsrt_setup() error.
- Call srt_cleanup() on libsrt_open() failure.
- Fix return value and method on mode parsing failure.

Based on a patch by Nicolas Sugino <nsugino@3way.com.ar>.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-16 23:15:09 +02:00
Paul B Mahol e704750a9f avfilter/af_aiir: use transposed II form for biquad sections 2020-10-16 23:07:27 +02:00
Paul B Mahol 0df0e12d02 avfilter/af_aiir: implement parallel processing 2020-10-16 23:07:27 +02:00
James Almer 0ed455b84e avcodec/av1dec: add cur_frame.spatial_id and temporal_id to AV1Frame
Will be used by hwaccels, which have access to a frame's AV1RawFrameHeader but not
its AV1RawOBUHeader.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-16 13:34:31 -03:00
Michael Niedermayer af701196ec tools/target_dem_fuzzer: Set format independent of c
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-16 14:56:24 +02:00
Andriy Gelman 2b5e18a953 avcodec/movtextenc: cosmetics
Change pointer position.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-10-15 22:30:13 -04:00
Andriy Gelman d4c46dc328 avcodec/movtextenc: fix writing to bytestream on BE arches
Fixes fate-binsub-movtextenc on PPC64

Currently tags are written in reverse order on BE arches. This is fixed
by using MKBETAG() and AV_RB32() to be arch agnostics.

Also s->font_count is of type int. On BE arches with 32bit int,
count = AV_RB16(&s->font_count) will read two most significant bytes
instead of the least significant bytes. This is fixed by assigning
s->font_count to count first.

The final change is modifying the type of len. On BE arches
the most significant byte of the int was written instead of the least
significant byte.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-10-15 22:27:37 -04:00
Andreas Rheinhardt 8e58db7348 avcodec/asvenc: Inline constants
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-16 00:39:07 +02:00
Andreas Rheinhardt 4f3edcdcbc avcodec/asvdec: Use init_get_bits8()
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-16 00:39:01 +02:00
Andreas Rheinhardt 2a8edb1ad3 avcodec/asvdec: Reduce the size of some VLCs
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-16 00:38:58 +02:00