ffmpeg.git
4 months agoavcodec/exr: skip bottom clearing loop when its outside the image
Michael Niedermayer [Sat, 24 Oct 2020 22:23:12 +0000 (00:23 +0200)]
avcodec/exr: skip bottom clearing loop when its outside the image

Fixes: signed integer overflow: 1633771809 * 32960 cannot be represented in type 'int'
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/exr: Check ymin vs. h
Michael Niedermayer [Sat, 24 Oct 2020 20:21:48 +0000 (22:21 +0200)]
avcodec/exr: Check ymin vs. h

Fixes: out of array access
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
Fixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/avs: Use 64bit for the avio_tell() output
Michael Niedermayer [Sat, 24 Oct 2020 22:23:10 +0000 (00:23 +0200)]
avformat/avs: Use 64bit for the avio_tell() output

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/moflex: Check pkt_size
Michael Niedermayer [Sat, 24 Oct 2020 22:23:07 +0000 (00:23 +0200)]
avformat/moflex: Check pkt_size

Fixes: Timeout (>20sec -> 1ms)
Fixes: 26527/clusterfuzz-testcase-minimized-ffmpeg_dem_MOFLEX_fuzzer-6308307310215168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavfilter/af_biquads: remove not needed code
Paul B Mahol [Sun, 22 Nov 2020 13:16:52 +0000 (14:16 +0100)]
avfilter/af_biquads: remove not needed code

4 months agoavformat/movenc: allow Apple Lossless inside mp4
Leo Izen [Fri, 20 Nov 2020 16:38:31 +0000 (11:38 -0500)]
avformat/movenc: allow Apple Lossless inside mp4

The 'alac' identifier has been registered to ISO and thus towards
ISOBMFF at the MP4 registration authority. The existing non-MOV
mux mode matches the official ALAC-in-MP4 specification.

4 months agoavfilter/af_afreqshift: add timeline and slice threading support
Paul B Mahol [Sun, 22 Nov 2020 09:44:49 +0000 (10:44 +0100)]
avfilter/af_afreqshift: add timeline and slice threading support

4 months agoavcodec/atrac3: increase max block align size
Paul B Mahol [Sat, 21 Nov 2020 21:09:17 +0000 (22:09 +0100)]
avcodec/atrac3: increase max block align size

Fixes decoding of lossy part of advanced lossless atrac3.
Regression since f09151fff9c754fbc1d2560adf18b14957f8b181

4 months agoavcodec/mobiclip: Check mv against INT_MAX
Michael Niedermayer [Sat, 14 Nov 2020 21:27:00 +0000 (22:27 +0100)]
avcodec/mobiclip: Check mv against INT_MAX

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 27369/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5083469356728320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/wavdec: More complete size check in find_guid()
Michael Niedermayer [Sat, 14 Nov 2020 21:13:52 +0000 (22:13 +0100)]
avformat/wavdec: More complete size check in find_guid()

Fixes: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'long'
Fixes: 27341/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5442833206738944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/mv30: Use unsigned in idct_1d()
Michael Niedermayer [Sat, 14 Nov 2020 20:10:18 +0000 (21:10 +0100)]
avcodec/mv30: Use unsigned in idct_1d()

Fixes: signed integer overflow: 2110302399 + 39074947 cannot be represented in type 'int'
Fixes: 27330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5664923153334272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/iff: Check size before skip
Michael Niedermayer [Sat, 14 Nov 2020 19:59:01 +0000 (20:59 +0100)]
avformat/iff: Check size before skip

Fixes: Infinite loop
Fixes: 27292/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5731168991051776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/rmdec: Check for EOF in index packet reading
Michael Niedermayer [Fri, 13 Nov 2020 22:30:47 +0000 (23:30 +0100)]
avformat/rmdec: Check for EOF in index packet reading

Fixes: Timeout(>10sec -> 1ms)
Fixes: 27284/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6304211110985728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/cuviddec: fix missing context push/pop
leozhang [Fri, 20 Nov 2020 03:23:43 +0000 (11:23 +0800)]
avcodec/cuviddec: fix missing context push/pop

Test command like below:
cuda-memcheck ./ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input_file -c:v h264_nvenc -f null -

Signed-off-by: leozhang <nowerzt@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 months agoavformat/rtsp: don't forget to call ff_network_close() on error
Andriy Gelman [Mon, 12 Oct 2020 20:36:09 +0000 (16:36 -0400)]
avformat/rtsp: don't forget to call ff_network_close() on error

In sdp_read_header() some ff_network_close() calls were missed.

Also in rtp_read_header() update comment to explain why a single
call to ff_network_close() is enough to cover all cases even if
sdp_read_header() returns an error.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 months agoavformat/rtsp: set return variable in error path
Andriy Gelman [Mon, 12 Oct 2020 20:36:08 +0000 (16:36 -0400)]
avformat/rtsp: set return variable in error path

In this error path ret still stores the number of bytes read in
ffurl_read().

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 months agoavformat/rtspdec: cosmetics
Andriy Gelman [Mon, 12 Oct 2020 20:36:07 +0000 (16:36 -0400)]
avformat/rtspdec: cosmetics

Make error check style consistent with rest of function.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 months agoavformat/rtspdec: fix mem leaks in connect mode if init fails
Andriy Gelman [Mon, 12 Oct 2020 20:36:06 +0000 (16:36 -0400)]
avformat/rtspdec: fix mem leaks in connect mode if init fails

Fixes #6334

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 months agoavformat/rtspdec: fix mem leaks in listen mode if init fails
Andriy Gelman [Mon, 12 Oct 2020 20:36:05 +0000 (16:36 -0400)]
avformat/rtspdec: fix mem leaks in listen mode if init fails

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 months agoavformat/rtspdec: add network init to listen mode
Andriy Gelman [Mon, 12 Oct 2020 20:36:04 +0000 (16:36 -0400)]
avformat/rtspdec: add network init to listen mode

As per the docs network initialization is required before ff_url_join().
Furthermore, because the ff_network_init() was skipped, this makes
one additional call to ff_network_close() if the stream exits without
errors.

The was forgotten in the origin commit of the listen mode:
a8ad6ffafe89e3a83f343f69249338e8245816f7

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 months agoavdevice/decklink_dec: map the raw_format instead of hardcode
Limin Wang [Thu, 19 Nov 2020 04:16:47 +0000 (12:16 +0800)]
avdevice/decklink_dec: map the raw_format instead of hardcode

The patch will change the numerical values for the string constants so bump
micro version.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agotools/target_bsf_fuzzer: set bitstream filter options
James Almer [Sun, 15 Nov 2020 01:14:24 +0000 (22:14 -0300)]
tools/target_bsf_fuzzer: set bitstream filter options

Should increase coverage with some bitstream filters

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agotools/target_bsf_fuzzer: Call av_bsf_flush() in a fuzzer choosen pattern
James Almer [Sun, 15 Nov 2020 01:11:17 +0000 (22:11 -0300)]
tools/target_bsf_fuzzer: Call av_bsf_flush() in a fuzzer choosen pattern

This should increase coverage.

Based on a commit by Michael Niedermayer

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agotools/target_dec_fuzzer: Call avcodec_flush_buffers() in a fuzzer choosen pattern
Michael Niedermayer [Sun, 15 Nov 2020 00:41:19 +0000 (21:41 -0300)]
tools/target_dec_fuzzer: Call avcodec_flush_buffers() in a fuzzer choosen pattern

This should increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
4 months agotools/target_dem_fuzzer: use avio_context_free() to free the fuzzer's AVIOContext
James Almer [Sat, 14 Nov 2020 20:19:04 +0000 (17:19 -0300)]
tools/target_dem_fuzzer: use avio_context_free() to free the fuzzer's AVIOContext

The doxy for avio_alloc_context() states it must be used for this.

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agolavfi/src_movie: switch to new decoding API
Anton Khirnov [Mon, 2 Nov 2020 11:26:18 +0000 (12:26 +0100)]
lavfi/src_movie: switch to new decoding API

4 months agodoc/examples/transcoding: switch to the new encoding API
Anton Khirnov [Thu, 29 Oct 2020 15:00:23 +0000 (16:00 +0100)]
doc/examples/transcoding: switch to the new encoding API

4 months agodoc/examples/transcoding: stop constantly allocating AVFrames
Anton Khirnov [Thu, 29 Oct 2020 15:00:23 +0000 (16:00 +0100)]
doc/examples/transcoding: stop constantly allocating AVFrames

Allocate just one and reuse it.

4 months agolavu: add missing stddef.h includes for size_t.
Anton Khirnov [Mon, 24 Feb 2020 12:18:57 +0000 (13:18 +0100)]
lavu: add missing stddef.h includes for size_t.

4 months agolavfi/lavfutils: switch to the new decoding API
Anton Khirnov [Sat, 18 Apr 2020 13:53:18 +0000 (15:53 +0200)]
lavfi/lavfutils: switch to the new decoding API

4 months agotools/enum_options: fix build and add to Makefile
Anton Khirnov [Sun, 12 Apr 2020 07:01:55 +0000 (09:01 +0200)]
tools/enum_options: fix build and add to Makefile

4 months agoavformat/matroskadec: only use the track duration if it exists
Steve Lhomme [Sun, 15 Nov 2020 09:00:35 +0000 (10:00 +0100)]
avformat/matroskadec: only use the track duration if it exists

No need to multiplying/dividing when we know it's zero.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 months agoavformat/matroskadec: adjust the cluster time to the track timebase
Steve Lhomme [Sun, 15 Nov 2020 08:59:48 +0000 (09:59 +0100)]
avformat/matroskadec: adjust the cluster time to the track timebase

The Block timestamp read in matroska_parse_block() is in track timebase and is
passed on as such to the AVPacket which uses this timebase.

In the normal case the Cluster and Track timebases are the same because the
track->time_scale is 1.0. But when it is not the case, the values in Cluster
timebase need to be transformed in Track timebase so they can be added
together.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 months agoavformat/matroskadec: add a warning when the track TimestampScale won't be used
Steve Lhomme [Sun, 15 Nov 2020 08:59:47 +0000 (09:59 +0100)]
avformat/matroskadec: add a warning when the track TimestampScale won't be used

Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 months agoavfilter/vf_lut3d: fix sanitizef INF handling
Mark Reid [Mon, 9 Nov 2020 01:12:29 +0000 (17:12 -0800)]
avfilter/vf_lut3d: fix sanitizef INF handling

Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 months agoavcodec/exr: use lookuptable for alpha if there is no trc_func
Mark Reid [Mon, 9 Nov 2020 03:37:23 +0000 (19:37 -0800)]
avcodec/exr: use lookuptable for alpha if there is no trc_func

Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 months agohttp: Check for AVERROR_EOF in the check for premature end
Martin Storsjö [Thu, 12 Nov 2020 22:06:30 +0000 (00:06 +0200)]
http: Check for AVERROR_EOF in the check for premature end

When the check was added (in 3668701f9600, in 2015), some IO
functions returned 0 on EOF (in particular, the TCP protocol
did, but the TLS protocol returned AVERROR_EOF). Since
0e1f771d2200d in 2017, the TCP protocol also returns AVERROR_EOF
instead of 0, making the check for premature end never have the
intended effect.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 months agoavformat/mpegts: make sure mpegts_read_header always stops at the first pmt
Marton Balint [Sat, 14 Nov 2020 23:31:11 +0000 (00:31 +0100)]
avformat/mpegts: make sure mpegts_read_header always stops at the first pmt

mpegts_read_header stops parsing the file at the first PMT. However the check
that ensured this was wrong because streams can also be added before the first
PMT is received (e.g. EIT).

So let's make sure we are in the header reading phase by checking if ts->pkt is
unset instead of checking if the number of streams found so far is 0.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 months agoavformat/dvenc: check the format before vst and ast[i] are initialized
Limin Wang [Thu, 27 Aug 2020 15:40:02 +0000 (23:40 +0800)]
avformat/dvenc: check the format before vst and ast[i] are initialized

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/dvenc: s->streams[i] -> st
Limin Wang [Thu, 27 Aug 2020 15:32:48 +0000 (23:32 +0800)]
avformat/dvenc: s->streams[i] -> st

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavfilter/vf_fade: config_props -> config_input
Limin Wang [Fri, 30 Oct 2020 13:45:28 +0000 (21:45 +0800)]
avfilter/vf_fade: config_props -> config_input

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavfilter/vf_fade: simplify code to use pts timebase for time check
Limin Wang [Fri, 30 Oct 2020 13:37:51 +0000 (21:37 +0800)]
avfilter/vf_fade: simplify code to use pts timebase for time check

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavfilter/vf_xfade: add squeeze transitions
Paul B Mahol [Thu, 19 Nov 2020 13:50:02 +0000 (14:50 +0100)]
avfilter/vf_xfade: add squeeze transitions

4 months agoavutil/frame: fix potential leaks in av_frame_ref()
Gil Pedersen [Wed, 18 Nov 2020 13:05:18 +0000 (13:05 +0000)]
avutil/frame: fix potential leaks in av_frame_ref()

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
4 months agoavutil/frame: use av_buffer_replace() to simplify code
Gil Pedersen [Wed, 18 Nov 2020 13:05:17 +0000 (13:05 +0000)]
avutil/frame: use av_buffer_replace() to simplify code

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Gil Pedersen <git@gpost.dk>
Signed-off-by: James Almer <jamrial@gmail.com>
4 months agoavcodec/wavpack: use av_buffer_replace() to simplify code
Gil Pedersen [Wed, 18 Nov 2020 13:05:16 +0000 (13:05 +0000)]
avcodec/wavpack: use av_buffer_replace() to simplify code

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Gil Pedersen <git@gpost.dk>
Signed-off-by: James Almer <jamrial@gmail.com>
4 months agoavfilter/vf_frei0r: add support for commands
Paul B Mahol [Thu, 19 Nov 2020 10:53:10 +0000 (11:53 +0100)]
avfilter/vf_frei0r: add support for commands

4 months agoavfilter/vf_despill: add support for commands
Paul B Mahol [Wed, 18 Nov 2020 16:34:52 +0000 (17:34 +0100)]
avfilter/vf_despill: add support for commands

4 months agoavfilter/af_afade: add sinc curve types
Paul B Mahol [Wed, 18 Nov 2020 10:10:39 +0000 (11:10 +0100)]
avfilter/af_afade: add sinc curve types

5 months agofate: Convert the musepack8 test to an oneoff test
Martin Storsjö [Wed, 11 Nov 2020 10:18:42 +0000 (12:18 +0200)]
fate: Convert the musepack8 test to an oneoff test

This fixes tests if built for x86 with x87 FPU.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 months agoavfilter/af_anlmdn: support all options as commands
Paul B Mahol [Tue, 17 Nov 2020 12:43:55 +0000 (13:43 +0100)]
avfilter/af_anlmdn: support all options as commands

5 months agoavfilter/af_anlmdn: allow to change smooth/m at runtime
Paul B Mahol [Tue, 17 Nov 2020 11:45:36 +0000 (12:45 +0100)]
avfilter/af_anlmdn: allow to change smooth/m at runtime

5 months agolavfi/frei0r: Remove duplicated pix_fmt entry
Andrew Rodland [Sat, 14 Nov 2020 18:10:39 +0000 (13:10 -0500)]
lavfi/frei0r: Remove duplicated pix_fmt entry

Fixes e.g. 'ffmpeg -i input.mp4 -vf frei0r=pixeliz0r output.mp4':

    [Parsed_frei0r_0 @ 0x5585b8093280] Duplicated pixel format
    Error reinitializing filters!
    Failed to inject frame into filter network: Invalid argument
    Error while processing the decoded data for stream #0:0
    Conversion failed!

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
5 months agoavcodec/mobiclip: Use get_ue_golomb_31() where possible
Andreas Rheinhardt [Thu, 5 Nov 2020 21:03:57 +0000 (22:03 +0100)]
avcodec/mobiclip: Use get_ue_golomb_31() where possible

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/asfdec_o: Remove code duplication
Andreas Rheinhardt [Tue, 17 Sep 2019 17:54:37 +0000 (19:54 +0200)]
avformat/asfdec_o: Remove code duplication

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/asfdec_o: Don't reset twice
Andreas Rheinhardt [Tue, 17 Sep 2019 17:49:51 +0000 (19:49 +0200)]
avformat/asfdec_o: Don't reset twice

A variable has been assigned a value twice consecutively; essentially
the same happens when one performs av_init_packet on an AVPacket after
a call to av_packet_unref.

Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/asfdec_o: Export metadata that applies to the whole file
Andreas Rheinhardt [Thu, 12 Nov 2020 16:57:37 +0000 (17:57 +0100)]
avformat/asfdec_o: Export metadata that applies to the whole file

The ASF specification of Metadata Objects' stream number is as follows:

"Specifies whether the entry applies to a specific digital media stream
or whether it applies to the whole file. A value of 0 in this field
indicates that it applies to the whole file; otherwise, the entry
applies only to the indicated stream number and must be between 1 and
127."

Yet the asf_o demuxer (the one originating from Libav) has always
treated such metadata as if it applied to a stream even though no stream
with a stream number may exist in a valid ASF file. This is fixed in
this commit; it affected e.g. the file
wma_with_metadata_library_object_tag_trimmed.wma from the FATE suite.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/asfdec_o: Don't segfault with lots of attached pics
Andreas Rheinhardt [Thu, 12 Nov 2020 15:13:48 +0000 (16:13 +0100)]
avformat/asfdec_o: Don't segfault with lots of attached pics

The ASF file format has a limit of 127 streams and the "asf_o" demuxer
(the ASF demuxer from Libav) has an array of pointers for a structure
called ASFStream that is allocated on demand for every stream. Attached
pictures are not streams in the sense of the ASF specification, yet the
demuxer created an ASFStream for them; and in one codepath it also
forgot to check whether the array of ASFStreams is already full. The
result is a write beyond the end of the array and a segfault lateron.

Fixing this is easy: Don't create ASFStreams for attached picture
streams.

(Other results of the current state of affairs are unnecessary allocations
(of ASFStreams structures), the misparsing of valid files (there might not
be enough ASFStreams left for the valid streams if attached pictures take
up too many); furthermore, the ASFStreams created for attached pictures all
have the stream number 0, an invalid stream number (the valid range is
1-127). This means that invalid data (packets for a stream with stream
number 0) won't get rejected lateron.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavfilter: add speechnorm filter
Paul B Mahol [Sat, 2 May 2020 18:27:37 +0000 (20:27 +0200)]
avfilter: add speechnorm filter

5 months agolsws/x86/yuv2rgb: Fix compilation with mmxext or ssse3 disabled.
Carl Eugen Hoyos [Sat, 14 Nov 2020 14:37:57 +0000 (15:37 +0100)]
lsws/x86/yuv2rgb: Fix compilation with mmxext or ssse3 disabled.

Fixes ticket #8986.

5 months agoavformat/rtsp: av_rescale -> av_rescale_q
Limin Wang [Fri, 30 Oct 2020 12:37:51 +0000 (20:37 +0800)]
avformat/rtsp: av_rescale -> av_rescale_q

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavcodec/cbs_av1: remove dead code
James Almer [Thu, 12 Nov 2020 18:20:38 +0000 (15:20 -0300)]
avcodec/cbs_av1: remove dead code

The other branch already covers cases where enable_order_hint is true
and frame is of type Inter.
Regression since ddb0e4fecdef24e8c7b90fa0a41d13e642ea732f

Fixes Coverity issues #1469194 and #1469195.

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/vp3dsp: Use unsigned constant to avoid undefined integer overflow in ff_vp3ds...
Michael Niedermayer [Mon, 9 Nov 2020 23:04:51 +0000 (00:04 +0100)]
avcodec/vp3dsp: Use unsigned constant to avoid undefined integer overflow in ff_vp3dsp_set_bounding_values()

Fixes: signed integer overflow: 64 * 33686018 cannot be represented in type 'int'
Fixes: 26911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-4904975073017856

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/icodec: Check for zero streams and stream creation failure
Michael Niedermayer [Wed, 4 Nov 2020 00:06:46 +0000 (01:06 +0100)]
avformat/icodec: Check for zero streams and stream creation failure

Fixes: NULL pointer dereference
Fixes: 26814/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-5758487797432320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/icodec: Factor failure code out in read_header()
Michael Niedermayer [Wed, 4 Nov 2020 00:06:45 +0000 (01:06 +0100)]
avformat/icodec: Factor failure code out in read_header()

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/nvdec_av1: fix setting film grain parameters for frames with update_grain...
James Almer [Thu, 12 Nov 2020 20:17:04 +0000 (17:17 -0300)]
avcodec/nvdec_av1: fix setting film grain parameters for frames with update_grain == 0

The spec in section 6.8.20 states the parameters should be loaded from a
reference frame indexed by film_grain_params_ref_idx.

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/av1dec: remove order_hint from AV1Frame
James Almer [Thu, 12 Nov 2020 20:06:05 +0000 (17:06 -0300)]
avcodec/av1dec: remove order_hint from AV1Frame

We now have access to the raw frame header, so use that

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/av1dec: add a reference to the raw frame header to AV1Frames
James Almer [Thu, 12 Nov 2020 19:59:37 +0000 (16:59 -0300)]
avcodec/av1dec: add a reference to the raw frame header to AV1Frames

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/dxva2: add AV1 decode support
Hendrik Leppkes [Thu, 5 Nov 2020 13:13:14 +0000 (14:13 +0100)]
avcodec/dxva2: add AV1 decode support

Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
5 months agoaviobuf: Increase the default SHORT_SEEK_THRESHOLD to 32 KB
Martin Storsjö [Fri, 30 Oct 2020 10:59:03 +0000 (12:59 +0200)]
aviobuf: Increase the default SHORT_SEEK_THRESHOLD to 32 KB

The previous threshold, 4 KB, maybe was reasonable when it was set
(in 2010), but in today's settings and with typical network speeds
and data sizes, it's pretty small. 32 KB probably is a more reasonable
default now, regardless of input.

This changes the test references for two seek tests.

When using the normal seek function, which boils down to the lseek(2)
function, a seek to an out of bounds position doesn't return an error,
but that condition is only reported when doing the subsequent read
(which returns EOF). When doing more seeks by fast forwarding, the
fact that the seeked to destination is out of bounds is noticed and
reported sooner in these cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 months agoavcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV
Andreas Rheinhardt [Thu, 12 Nov 2020 06:15:29 +0000 (07:15 +0100)]
avcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV

Fixes Coverity ID 1469181.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/nvdec: add av1 hwaccel
Timo Rothenpieler [Sat, 17 Oct 2020 16:16:54 +0000 (18:16 +0200)]
avcodec/nvdec: add av1 hwaccel

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Co-authored-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/nvdec: add support for separate reference frame
Timo Rothenpieler [Sat, 17 Oct 2020 16:16:36 +0000 (18:16 +0200)]
avcodec/nvdec: add support for separate reference frame

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
5 months agoavcodec/av1dec: expose coded_lossless
Timo Rothenpieler [Tue, 3 Nov 2020 14:54:44 +0000 (15:54 +0100)]
avcodec/av1dec: expose coded_lossless

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Co-authored-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/av1dec: expose skip mode frame index
Timo Rothenpieler [Tue, 3 Nov 2020 14:34:28 +0000 (15:34 +0100)]
avcodec/av1dec: expose skip mode frame index

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Co-authored-by: James Almer <jamrial@gmail.com>
5 months agoavformat/bintext: Check width
Michael Niedermayer [Sat, 31 Oct 2020 12:51:47 +0000 (13:51 +0100)]
avformat/bintext: Check width

Fixes: division by 0
Fixes: 26780/clusterfuzz-testcase-minimized-ffmpeg_dem_ADF_fuzzer-5117945027756032
Fixes: 26998/clusterfuzz-testcase-minimized-ffmpeg_dem_ADF_fuzzer-5119352359354368

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/sbgdec: Check that end is not before start
Michael Niedermayer [Mon, 9 Nov 2020 23:04:50 +0000 (00:04 +0100)]
avformat/sbgdec: Check that end is not before start

Fixes: signed integer overflow: -9223372036854775808 + -5279949906739200 cannot be represented in type 'long'
Fixes: 26908/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6329610851319808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/cbs_av1: add a range check to tg_end
James Almer [Tue, 27 Oct 2020 21:25:06 +0000 (18:25 -0300)]
avcodec/cbs_av1: add a range check to tg_end

Section 6.10.1 of the AV1 spec states:

It is a requirement of bitstream conformance that the value of tg_start is
equal to the value of TileNum at the point that tile_group_obu is invoked.
It is a requirement of bitstream conformance that the value of tg_end is
greater than or equal to tg_start.

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream
James Almer [Thu, 29 Oct 2020 12:54:59 +0000 (09:54 -0300)]
avcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavformat/rtspdec: return proper error code
Limin Wang [Wed, 4 Nov 2020 13:06:00 +0000 (21:06 +0800)]
avformat/rtspdec: return proper error code

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtsp: check return value of ffurl_read_complete
Limin Wang [Wed, 4 Nov 2020 12:44:43 +0000 (20:44 +0800)]
avformat/rtsp: check return value of ffurl_read_complete

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtsp: prefer to use variable instead of type
Limin Wang [Wed, 4 Nov 2020 12:09:02 +0000 (20:09 +0800)]
avformat/rtsp: prefer to use variable instead of type

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtspdec: use SDP_MAX_SIZE for sdp array
Limin Wang [Wed, 4 Nov 2020 11:55:48 +0000 (19:55 +0800)]
avformat/rtspdec: use SDP_MAX_SIZE for sdp array

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtsp: move SDP_MAX_SIZE macro definition to header file
Limin Wang [Wed, 11 Nov 2020 10:26:26 +0000 (18:26 +0800)]
avformat/rtsp: move SDP_MAX_SIZE macro definition to header file

move comments for the size of SDP_MAX_SIZE here:
Some SDP lines, particularly for Realmedia or ASF RTSP streams,
contain long SDP lines containing complete ASF Headers (several
kB) or arrays of MDPR (RM stream descriptor) headers plus
"rulebooks" describing their properties. Therefore, the SDP line
buffer is large.
The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
in rtpdec_xiph.c.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/rtsp: 16384 -> SDP_MAX_SIZE
Limin Wang [Wed, 4 Nov 2020 12:51:06 +0000 (20:51 +0800)]
avformat/rtsp: 16384 -> SDP_MAX_SIZE

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/lvfdec: Check stream_index before use
Michael Niedermayer [Sat, 7 Nov 2020 23:17:09 +0000 (00:17 +0100)]
avformat/lvfdec: Check stream_index before use

Fixes: assertion failure
Fixes: 26905/clusterfuzz-testcase-minimized-ffmpeg_dem_LVF_fuzzer-5724267599364096.fuzz

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>
5 months agoavformat/au: cleanup on EOF return in au_read_annotation()
Michael Niedermayer [Thu, 5 Nov 2020 19:23:54 +0000 (20:23 +0100)]
avformat/au: cleanup on EOF return in au_read_annotation()

Fixes: memleak
Fixes: 26841/clusterfuzz-testcase-minimized-ffmpeg_dem_AU_fuzzer-5174166309044224
Regression since: e680d50eb4feddafb2d8575b21fc5fc8764f4801
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agolibavformat/avidec: Extract more metadata from the header
Thierry Foucu [Fri, 6 Nov 2020 23:10:17 +0000 (15:10 -0800)]
libavformat/avidec: Extract more metadata from the header

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavfilter/af_asoftclip: add oversampling support
Paul B Mahol [Thu, 5 Nov 2020 12:33:32 +0000 (13:33 +0100)]
avfilter/af_asoftclip: add oversampling support

5 months agoavcodec/gdv: Remove dead check
Andreas Rheinhardt [Thu, 5 Nov 2020 20:35:56 +0000 (21:35 +0100)]
avcodec/gdv: Remove dead check

At the end of its decode function, the decoder sets *got_frame to 1 and
then checks whether ret is < 0; if so, it is returned, otherwise
avpkt->size is. But it is impossible for ret to be < 0 here and if it
were, it would be nonsense to set *got_frame to 1 before this. Therefore
just return avpkt->size unconditionally.

Fixes Coverity issue #1439730.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/utils: clear the packet props queue on flushing
James Almer [Mon, 9 Nov 2020 13:12:59 +0000 (10:12 -0300)]
avcodec/utils: clear the packet props queue on flushing

This ensures no queued timestamps or side data are kept and used after
seeking, preventing potential desyncs.

Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoChangelog: add amv muxer & encoder
Zane van Iperen [Mon, 9 Nov 2020 05:15:27 +0000 (15:15 +1000)]
Changelog: add amv muxer & encoder

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
5 months agoavformat: add amv muxer
Zane van Iperen [Mon, 2 Nov 2020 05:47:32 +0000 (15:47 +1000)]
avformat: add amv muxer

AMV is a hard-coded (and broken) subset of AVI. It's not worth sullying
the existing AVI muxer with its filth.

Fixes ticket #747.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
5 months agoavcodec: add adpcm_ima_amv encoder
Zane van Iperen [Mon, 2 Nov 2020 05:47:29 +0000 (15:47 +1000)]
avcodec: add adpcm_ima_amv encoder

Fixes ticket #747.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
5 months agoavcodec/adpcm_ima_amv: document header format
Zane van Iperen [Mon, 2 Nov 2020 05:47:26 +0000 (15:47 +1000)]
avcodec/adpcm_ima_amv: document header format

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
5 months agoavcodec/adpcm_ima_amv: use coded sample count
Zane van Iperen [Mon, 2 Nov 2020 05:47:24 +0000 (15:47 +1000)]
avcodec/adpcm_ima_amv: use coded sample count

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
5 months agoavcodec/adpcm_ima_amv: restrict to 1 channel
Zane van Iperen [Mon, 2 Nov 2020 05:47:21 +0000 (15:47 +1000)]
avcodec/adpcm_ima_amv: restrict to 1 channel

The format doesn't allow for anything else.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
5 months agolavc/amfenc: Add hardware config metadata
OvchinnikovDmitrii [Thu, 15 Oct 2020 00:16:21 +0000 (03:16 +0300)]
lavc/amfenc: Add hardware config metadata

Without this metadata section the ffmpeg utility thinks that the AMF encoder
does not support input from D3D11 and DXVA2 hardware surfaces, causing
hardware pipelines to fail.

Fixes #8953.

5 months agolavc: Mark hw_config pointer arrays as const
Mark Thompson [Sun, 8 Nov 2020 18:51:15 +0000 (18:51 +0000)]
lavc: Mark hw_config pointer arrays as const

They are read-only just like the HWConfig structures they point to.

5 months agotools/target_dem_fuzzer: Consider it an EIO when reading position wraps around 64bit
Michael Niedermayer [Fri, 23 Oct 2020 08:48:36 +0000 (10:48 +0200)]
tools/target_dem_fuzzer: Consider it an EIO when reading position wraps around 64bit

Fixes: signed integer overflow: 9223372036854775807 + 564 cannot be represented in type 'long'
Fixes: 26494/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-576754158849228
Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824
FIxes: 26875/clusterfuzz-testcase-minimized-ffmpeg_dem_C93_fuzzer-5996226782429184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>