Commit Graph

101444 Commits

Author SHA1 Message Date
Andreas Rheinhardt 491a30c79c avformat/aadec: Replace strncpy by av_strlcpy
While this usage of strncpy is correct, said function nevertheless has
the disadvantage of not automatically ensuring that the destination
string is zero-terminated. So av_strlcpy should be preferred.
This also removes a -Wstringop-truncation warning from GCC (it doesn't
matter whether the buffer is truncated, as long as it can fit all
the names of the supported codecs).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-05 09:16:00 +01:00
Andreas Rheinhardt 80038fd524 avformat/aadec: Use smaller scope for variables, remove initializations
avio_get_str always zero terminates the strings it reads.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-05 09:16:00 +01:00
Carl Eugen Hoyos b6fe10fa39 lavf/sga: Silence several warnings because of wrong format specifiers.
Fixes warnings like:
warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument n has type ‘uint64_t’
2021-03-04 22:22:36 +01:00
Marton Balint 088f35f036 avformat/mxfdec: add support for getting product version number metadata
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-04 20:23:51 +01:00
Marton Balint 7cb40b270c avformat/mxfdec: change toolkit_version metadata field to toolkit_version_num
It only got added recently, and the new name makes it consistent with
product_version_num in the next patch.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-04 20:23:49 +01:00
Paul B Mahol 433227d452 avcodec/speedhq: fix decoding non 444 subsampling when width is not multiple of 16 2021-03-04 19:09:56 +01:00
James Almer f7840917da avcodec/decode: constify the source packet parameter in extract_packet_props()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-03 19:26:20 -03:00
James Almer 77ce903f7a avcodec/utils: free last_pkt_props on avcodec_open2() failure
Regression since b34d1de8dc

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-03 18:05:15 -03:00
James Almer b34d1de8dc avcodec/decode: port last_pkt_props to AVFifoBuffer
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-03 13:10:27 -03:00
Michael Niedermayer 7819412f44 avformat/lxfdec: Fix multiple integer overflows related to track_size
Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_LXF_fuzzer-6634030636335104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-03 16:54:20 +01:00
Michael Niedermayer 6c5121379a avformat/mccdec: Use av_sat_add64() for fs
Fixes: signed integer overflow: -9223372036854775808 + -242 cannot be represented in type 'long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_MCC_fuzzer-6723018395090944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-03 16:54:20 +01:00
Michael Niedermayer 5d7f17e885 avutil/parseutils: Check sign in av_parse_time()
Fixes: signed integer overflow: -9223372053736 * 1000000 cannot be represented in type 'long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-6607924558430208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-03 16:54:20 +01:00
Michael Niedermayer 787501db16 avformat/mspdec: Check packet_size more completely
Fixes: OOM
Fixes: 28348/clusterfuzz-testcase-minimized-ffmpeg_dem_MSP_fuzzer-4612055872831488
Fixes: 28360/clusterfuzz-testcase-minimized-ffmpeg_dem_MSP_fuzzer-6245230626078720

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>
2021-03-03 16:54:20 +01:00
Michael Niedermayer 460d3dc41f avformat/aiffdec: Check that SSND is at least 8 bytes
Fixes: Infinite loop
Fixes: 30874/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-5933710488764416

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>
2021-03-03 16:54:20 +01:00
Michael Niedermayer fdcb966f4a avformat/dcstr: Check sample rate
Fixes: signed integer overflow: -1300248894420254720 * 16 cannot be represented in type 'long'
Fixes: 30879/clusterfuzz-testcase-minimized-ffmpeg_dem_DCSTR_fuzzer-5094464215449600

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>
2021-03-03 16:54:20 +01:00
Andreas Rheinhardt 6a3f345c1a avformat/frmdec: Simplify finding pixel format
The fourccs used by the Megalux Frame format to determine the pixel
format are actually no fourccs at all as they are a single byte.
Furthermore, their range is continuous (1-5), so they are actually
ordinary indices. So treat them as such and don't use PixelFormatTags
for them.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-03 16:46:09 +01:00
Andreas Rheinhardt 2ff40b98ec avformat: Deprecate AVFMT_FLAG_PRIV_OPT, remove av_demuxer_open on bump
This flag was added in 492026209b
in conjunction with av_demuxer_open() to allow to pass private
options to demuxers. It worked as follows: av_open_input_stream()
(the predecessor of avformat_open_input()) would not call the
read_header function if this flag is set. Instead the user could set
private options of the demuxer via the format's private class after
avformat_open_input() and then call av_demuxer_open() which called
the format's read_header function.

This approach was abandoned in e37f161e66
and av_demuxer_open() deprecated; instead the AVDictionary based way of
passing private options to the demuxer was choosen. Yet
AVFMT_FLAG_PRIV_OPT has never been deprecated and av_demuxer_open()
never removed. This commit implements the deprecation of the flag and
schedules av_demuxer_open for removal on the next major bump.
Given that av_demuxer_open() has been deprecated in 2012 and that this
flag is useless without it, the flag will be ignored after the next
major version bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-03 14:41:08 +01:00
Ronald S. Bultje d29ec02d48 ivfenc: write duration for frame_cnt=1. 2021-03-03 07:22:02 -05:00
Paul B Mahol 82131293b0 avcodec/float2half: fix minor style issue 2021-03-03 12:49:57 +01:00
Paul B Mahol 3be33703c6 avcodec/half2float: fix integer overflows in convertmantissa() 2021-03-03 12:41:44 +01:00
Michael Niedermayer 4dc039b4c7 avcodec/mobiclip: Avoid undefined integer overflow in MV computation
Fixes: signed integer overflow: 1 + 2147483647 cannot be represented in type 'int'
Fixes: 30877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-4775601145774080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-03 11:40:40 +01:00
Michael Niedermayer 53d739db4e avcodec/alsdec: Check bitstream input in read_block()
Fixes: Timeout
Fixes: 28110/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5036338973507584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-03 11:40:40 +01:00
Paul B Mahol 6cc3ba4be6 avcodec/exr: add lut oriented half to float conversion code 2021-03-02 20:53:04 +01:00
Paul B Mahol cf2f8dcc6a avcodec/exrenc: move float2half code to own header 2021-03-02 20:53:04 +01:00
Paul B Mahol cc85ca1cb3 avcodec/exr: add DWA decompression support 2021-03-02 20:53:04 +01:00
Paul B Mahol 2fc309e699 avcodec/svq1dec: use av_fast_padded_malloc() for allocation pmv only when necessary 2021-03-02 15:06:22 +01:00
Andreas Rheinhardt 98c5d6b845 avformat/dashdec: Increase size of id buffer
The current size is not enough, see e.g.
http://ftp.itec.aau.at/datasets/DASHDataset2014/TearsOfSteel/1sec/TearsOfSteel_1s_simple_2014_05_09.mpd

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 11:49:28 +01:00
Andreas Rheinhardt ec5663d0a7 avformat/dashdec: Ensure strings are zero-terminated
strncpy only ensures that one does not write beyond the end of the
destination buffer; in case of truncation it does not zero-terminate
the destination buffer. This makes using it the way it is now in the
DASH demuxer dangerous. So use av_strlcpy instead.

Also don't write anything if there is no id: The buffer has already been
zeroed initially.

The DASH testset from the Universität Klagenfurt contains samples with
ids that are too long. E.g.
http://ftp.itec.aau.at/datasets/DASHDataset2014/TearsOfSteel/1sec/TearsOfSteel_1s_simple_2014_05_09.mpd

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 11:49:10 +01:00
Andreas Rheinhardt 988deae6da fftools: Switch to const AVCodec * where possible
The obstacle to do so was in filter_codec_opts: It uses searches
the AVCodec for options via the AV_OPT_SEARCH_FAKE_OBJ method, which
requires using a void * that points to a pointer to a const AVClass.
When using const AVCodec *, one can not simply use a pointer that points
to the AVCodec's pointer to its AVClass, as said pointer is const, too.
This is fixed by using a temporary pointer to the AVClass.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 08:20:10 +01:00
Andreas Rheinhardt c17915fd64 avcodec/mpegvideo: Schedule unused, deprecated rc_strategy for removal
Deprecated in d05c3b9cee.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 07:32:50 +01:00
Andreas Rheinhardt efa012cbdb fate/matroska: Test remuxing tracks for hearing/visually impaired
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 07:10:46 +01:00
Andreas Rheinhardt 9b06c4c10d avformat/matroskaenc: Add support for FlagOriginal
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 07:04:11 +01:00
Andreas Rheinhardt b243be85d9 avformat/matroskadec: Add support for FlagOriginal
Needs a CountedElement in order to distinguish the case of the element
not being present and the element being present with a value of zero.

(It has been argued by Ridley Combs that one should only ever use the
AV_DISPOSITION_DUB field for audio tracks. Yet given that there is no
definition for the disposition flags, one can also interpret it to mean
that e.g. a subtitle track is meant to be used with the dubbed audio
track or the original audio track. This commit interprets this flag in
this sense, which also allows to maintain it on remuxing.)

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 06:54:47 +01:00
Michael Niedermayer 74c4c53953 avformat/mov: Extend data_size check in mov_read_udta_string()
Fixes: signed integer overflow: -2147483634 - 16 cannot be represented in type 'int'
Fixes: 28322/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5711888402612224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-01 20:19:15 +01:00
Michael Niedermayer bcc7d14453 avformat/aadec: Check for EOF while reading chapters
Fixes: timeout
Fixes: 28199/clusterfuzz-testcase-minimized-ffmpeg_dem_AA_fuzzer-4896162657861632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-01 20:19:15 +01:00
Michael Niedermayer ee50f72715 avcodec/h2645_parse: Reduce the initial skipped_bytes_pos size with small inputs
Fixes: OOM
Fixes: 23817/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-6300869057576960
Fixes: 28055/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5706035297517568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-01 20:19:15 +01:00
Michael Niedermayer 52f75181bf avformat/voc_packet: Add a basic check on max_size
Fixes: signed integer overflow: -2147483648 - 4 cannot be represented in type 'int'
Fixes: 28127/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-4880586455646208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-01 20:19:15 +01:00
Paul B Mahol 498be38e32 avformat/sga: improve probing for valid files
Update variables depending on high four bits of first two bytes.
2021-03-01 18:41:19 +01:00
Paul B Mahol c6c82428af avformat: add Digital Pictures SGA game demuxer 2021-03-01 17:41:05 +01:00
Paul B Mahol 6b43e1a86c avcodec: add SGA Video decoder 2021-03-01 17:36:42 +01:00
Paul B Mahol 5111707df6 avcodec: add SGA PCM decoder 2021-03-01 17:36:16 +01:00
Andreas Rheinhardt 0e645b98c6 Remove double ';'
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:10:44 +01:00
Andreas Rheinhardt 590f491b0a avcodec/roqvideoenc: Avoid allocating buffers separately
This is possible because their size is known at compile-time; so they
can be put directly into the context and don't need to be allocated for
every frame.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:07:48 +01:00
Andreas Rheinhardt ed89ebb12e avcodec/roqvideoenc: Avoid intermediate buffer
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:07:35 +01:00
Andreas Rheinhardt 9b776cd542 avcodec/roqvideoenc: Reuse buffers instead of alloc+free for each frame
In case of the cel evaluators it even allows to perform the
initialization of the source coordinates only once instead of for each
frame.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:07:28 +01:00
Andreas Rheinhardt 1a4a5fb640 avcodec/roqvideo: Use dedicated context for encoder
Up until now, the RoQ video decoder and encoder used the same context;
and said context contained several fields that are only used by the
encoder. This commit changes this and uses a dedicated context for the
encoder; it contains the common context as first element in order to use
functions common to the de- and encoder.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:04:46 +01:00
Paul B Mahol 4cb989e836 avcodec/exr: add fast path for case when powf() isn't needed 2021-02-28 23:19:01 +01:00
Michael Niedermayer f01d522cf3 avcodec/dxtory: Fix undefined shift with negative linesize
Fixes: left shift of negative value -128
Fixes: 30746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXTORY_fuzzer-5906271469436928

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>
2021-02-28 20:11:03 +01:00
Andreas Rheinhardt 3072438429 doc/codecs.texi: Remove removed or ineffective options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:55:39 +01:00
Andreas Rheinhardt f9b5cef1d3 avcodec/libx264: Don't use init_static_data for newer versions
x264 versions >= 153 can support multiple bitdepths; they also don't
export x264_bit_depth any more. The actual check whether a bitdepth
is supported is therefore performed at runtime in x264_encoder_open.
Ergo it is unnecessary to use init_static_data for these versions:
One can already set ff_libx264_encoder.pix_fmts to the value that
X264_init_static always sets it to.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:52:12 +01:00