1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-07 11:13:41 +02:00
Commit Graph

99727 Commits

Author SHA1 Message Date
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
Andreas Rheinhardt
6608ecb1b5 avcodec/ylc: Inline constants
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-16 00:38:50 +02:00
Andreas Rheinhardt
753e450a71 avcodec/v3/408enc: Remove empty close functions
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-16 00:29:06 +02:00
Michael Niedermayer
7265b7d904 avcodec/exr: Fix overflow with many blocks
Fixes: signed integer overflow: 1073741827 * 8 cannot be represented in type 'int'
Fixes: 25621/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6304841641754624

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-15 23:38:58 +02:00
James Almer
191f68aec1 avcodec/Makefile: add missing av1_cuvid entry
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-15 18:30:04 -03:00
Timo Rothenpieler
0a31d57a56 configure: check for nvdec/cuvid AV1 support 2020-10-15 23:25:05 +02:00
Michael Niedermayer
394e8bb385 avcodec/vp9dsp_template: Fix integer overflows in idct16_1d()
Fixes: signed integer overflow: -190760 * 11585 cannot be represented in type 'int'
Fixes: 25471/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5743354917421056

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-15 22:53:56 +02:00
Michael Niedermayer
949f0a6be9 avcodec/ansi: Check initial dimensions
Fixes: Timeout (minutes to less than 1sec)
Fixes: 25682/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ANSI_fuzzer-6320712032452608

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-15 22:53:56 +02:00
Michael Niedermayer
106f11f68a avcodec/hevcdec: Check slice_cb_qp_offset / slice_cr_qp_offset
Fixes: signed integer overflow: 29 + 2147483640 cannot be represented in type 'int'
Fixes: 25413/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5697909331591168

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-15 22:53:56 +02:00
Michael Niedermayer
eeabdef1bf avcodec/sonic: Check for overread
Fixes: Timeout (too long -> 1.3 sec)
Fixes: 24358/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5107284099989504

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-15 22:53:56 +02:00
Michael Niedermayer
92233a6344 avcodec/mobiclip: Check that Motion vectors are within the input frame
The MV checks did not consider the width and height of the block, also they
had some off by 1 errors. This resulted in undefined behavior and crashes.
This commit instead errors out on these

Fixes: out of array read
Fixes: 26080/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5758146355920896

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-15 22:53:56 +02:00
Michael Niedermayer
b6b640c544 avcodec/mobiclip: set the bitstream size to the input
Fixes: out of array read
Fixes: 25453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5163575973511168

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>
2020-10-15 22:53:56 +02:00
James Almer
0467991de7 avcodec/allcodecs: move av1_cuvid below libaom_av1
Software decoders should always be first.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-15 17:29:27 -03:00
Roman Arzumanyan
b23e6ae886 avcodec/cuviddec: add av1 support
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-10-15 21:20:40 +02:00
Michael Niedermayer
b7f51428b1 avformat/subviewerdec: fail on AV_NOPTS_VALUE
Such values are not supported by ff_subtitles_queue*

Fixes: signed integer overflow: 10 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 24193/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5714901855895552

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-15 18:44:31 +02:00
Chris Miceli
0c90377a40 libavformat/avidec: check memory allocation
Memory allocation for AVIOContext should be checked. In this code,
all error conditions are sent to the "goto error".

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-14 21:11:49 +02:00
Chris Miceli
6bdfea8d4b libavfilter/dnn/dnn_backend{openvino, tf}: check memory alloc non-NULL
These previously would not check that the return value was non-null
meaning it was susceptible to a sigsegv. This checks those values.
2020-10-14 11:08:09 +08:00
Chris Miceli
ad95e5e45d libavfilter/dnn_backend_native: check mem allocation
check that frame allocations return non-null.
2020-10-14 10:19:05 +08:00
Andreas Rheinhardt
00772ef4f7 avcodec/webp: Use LE VLC table for LE bitstream reader
The WebP format uses Huffman tables and the decoder therefore uses
VLC tables. Given that WebP is a LE format, a LE bitreader is used;
yet the VLC table is not created for a LE reader (the process used to
create the tables puts the last bit to be read in the lowest bit) and
therefore custom code for reading the VLCs that reverses the bits
read is used instead of get_vlc2(). This commit changes this to use
a table designed for LE bitreader which allows to use get_vlc2() directly.
The necessary reversing of the codes is delegated to
ff_init_vlc_sparse() (and is therefore only done during init and not
when actually reading the VLCs).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 22:40:00 +02:00
Andreas Rheinhardt
d7a503ecf9 avcodec/ivi: Avoid reversing BE VLC codes for LE bitstream reader
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 22:38:40 +02:00
Andreas Rheinhardt
3977aeb78c avcodec/speedhq: Avoid reversing BE codes for LE bitstream reader
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 22:35:40 +02:00
Andreas Rheinhardt
9eb7d8b45d avcodec/vlc, bitstream: Allow to use BE codes to initialize LE VLC
This is easily possible because ff_init_vlc_sparse() already transforms
both LE as well as BE codes to a normal form internally before
processing them further. This will be used in subsequent commits.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 22:20:37 +02:00
Andreas Rheinhardt
e78bbbc2b1 avcodec/speedhq: Don't use ff_ prefix for static symbols
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 22:18:44 +02:00
Andreas Rheinhardt
7b6acfa68f avcodec/speedhq: Don't pretend reading DC can fail
It can't, because the tables used don't have any loose ends. This also
fixes a bug in the only caller of decode_dc_le(): It didn't check the
return value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 22:17:22 +02:00
Andreas Rheinhardt
57eee75c3f avcodec/indeo2: Remove #ifdef BITSTREAM_READER_LE cruft
Before the LE bitstream reader was used in the Indeo 2 decoder,
a standard BE bitstream reader with swapped bits was used; when the LE
bitstream reader was added, the old code was only #ifdef'ed away and not
removed. Said code has several problems: It modifies the input packet
without ensuring that the packet is indeed writable; and it doesn't work
since 09c4e5c598 because said commit
removed the BE table used to initialize the VLC table. So just remove
this cruft from the actual decoder, too.

Also use INIT_LE_VLC_STATIC while at it.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 22:06:28 +02:00
leozhang
b9727870ae avfilter/vf_scale_cuda: unload cuModule on uninit
Signed-off-by: leozhang <nowerzt@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-10-12 21:09:21 +02:00
Michael Niedermayer
d40679d89c Add support for building fuzzer tools for an individual demuxer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-12 21:01:48 +02:00
Tomas Härdin
86b485b5d6 fate-mxf-probe-applehdr10: Ignore endianness 2020-10-12 20:21:36 +02:00
Michael Niedermayer
d40f249861 avcodec/cbs_av1: Free content in cbs_av1_free_metadata()
Fixes: memleak
Fixes: 25838/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5736255957237760

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-12 17:54:52 +02:00
Paul B Mahol
f7fd205f11 avfilter/af_sofalizer: allow up to 64 channels 2020-10-12 12:21:35 +02:00
Paul B Mahol
aa125fd06a avfilter/af_sofalizer: allow to specify virtual speakers indetifier as number 2020-10-12 12:21:35 +02:00
Paul B Mahol
2fb517855a avcodec/apedec: use proper macro and type for pivot variable 2020-10-12 12:20:26 +02:00
Paul B Mahol
ea0972f6dd avcodec/apedec: properly calculate and store absolute value 2020-10-12 12:20:26 +02:00
Paul B Mahol
ed0001482a avcodec/apedec: fix decoding 24bit insane files with recent versions 2020-10-12 12:20:26 +02:00
Paul B Mahol
af5ad79fe1 avformat/isom: add support for RAW ASC Bayer BGGR in mov 2020-10-12 12:19:29 +02:00
Andreas Rheinhardt
7800cc6e82 avcodec/mpeg12: Don't pretend reading dct_dc_size_* VLCs can fail
It can't because the corresponding trees don't have any loose ends.

Removing the checks also removed an instance of av_log(NULL (with a
nonsense message) from the codebase.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 02:10:41 +02:00
Andreas Rheinhardt
c4990409f2 avcodec/mpeg12: Reduce size of motion-vector VLC
It currently uses 9 bits per table, but there are no codes with
nine bits at all, while there are codes with eight, ten and eleven bits.
So reducing the table size to eight bits will not reduce the amount of
codes that can be parsed in the first step, but it allows to reduce the
size of the motion-vector VLC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-12 02:00:08 +02:00
Carl Eugen Hoyos
86f0bba776 lavc, lavf: Remove newlines from calls to avpriv_request_sample(). 2020-10-11 19:59:24 +02:00
Michael Niedermayer
9b72cea446 avcodec/exr: Check line size for overflow
Fixes: signed integer overflow: 570425356 * 6 cannot be represented in type 'int
Fixes: 25929/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5099197739827200

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-11 16:42:49 +02:00
Michael Niedermayer
6949df35d0 avcodec/exr: Check xdelta, ydelta
Fixes: assertion failure
Fixes: 25617/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5648746061496320

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-11 16:42:49 +02:00
Michael Niedermayer
991246657b avcodec/adpcm: Check block align for AV_CODEC_ID_ADPCM_PSX
Regression since: ca49476ace
Fixes: out of array write
Fixes: 25786/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5704869380620288

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-11 16:42:49 +02:00
Michael Niedermayer
0aa1645140 avcodec/mobiclip: Fix multiple integer overflows
Fixes: signed integer overflow: 872415232 * 7 cannot be represented in type 'int'
Fixes: signed integer overflow: -2013265888 + -1744830464 cannot be represented in type 'int'
Fixes: 25834/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5471406434025472

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-11 16:42:49 +02:00
Justin Ruggles
2be3eb7f77 Allow using only the mfra info for seeking using the fragment index
The mfra has enough information to enable seeking, and reading it is
behind an AVOption flag, so we shouldn't require that sidx information
also be present in order to seek using the fragment index.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-10-11 12:16:47 +01:00
Jan Ekström
7ea4bcff7b swscale/utils: override forced-zero formats back to full range
Fixes vf_scale outputting RGB AVFrames with limited range flagged
in case either input or output specifically sets the range.

This is the reverse of the logic utilized for RGB and PAL8 content
in sws_setColorspaceDetails.
2020-10-11 12:58:13 +03:00
Jan Ekström
3fe24fe232 swscale/utils: split range override check into its own function 2020-10-11 12:58:13 +03:00
James Almer
0c73c2909e avfilter/avfilter.h: add missing FF_API_NEXT wrapper
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-10 23:58:40 -03:00
James Almer
f0cec744a9 avformat/avformat.h: add missing FF_API_NEXT wrappers
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-10 23:58:26 -03:00