Commit Graph

84160 Commits

Author SHA1 Message Date
Michael Niedermayer bac9c03ed9 avcodec/movtextdec: run mov_text_cleanup() before overwriting pointers
Fixes: memleak
Fixes: 741/clusterfuzz-testcase-586996200452915

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-09 23:28:10 +01:00
Michael Niedermayer e2a4f1a9eb avcodec/mpeg4videodec: Fix runtime error: signed integer overflow: -135088512 * 16 cannot be represented in type 'int'
Fixes: 736/clusterfuzz-testcase-5580263943831552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-09 23:28:10 +01:00
Michael Niedermayer 222c9f031d avcodec/h264_mvpred: Fix runtime error: left shift of negative value -1
Fixes: 734/clusterfuzz-testcase-4821293192970240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-09 23:28:10 +01:00
Michael Niedermayer 800d02abe0 avcodec/mjpegdec: Fix runtime error: left shift of negative value -127
Fixes: 733/clusterfuzz-testcase-4682158096515072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-09 23:28:10 +01:00
Michael Niedermayer 58dd25f8ad avcodec/mpegaudiodec_template: Check for negative e
Fixes: undefined shift
Fixes: 631/clusterfuzz-testcase-6725491035734016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-09 20:37:10 +01:00
Timo Rothenpieler 5cd3cd5b68 avcodec/cuvid: add support for cropping/resizing
Overhauled version, original patch by Miroslav Slugeň <thunder.m@email.cz>.
2017-03-09 18:39:15 +01:00
James Almer 58eb0f57f6 avformat/matroskaenc: add support for Spherical Video elements
Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-09 13:57:03 -03:00
wm4 f940492bb2 avcodec: clarify some decoding/encoding API details
Make it clear that there is no timing-dependent behavior. In particular,
there is no state in which both input and output are denied, and where
you have to wait for a while yourself to make progress (apparently some
hardware decoders like to do this).

Avoid wording that makes references to time. It shouldn't be mistaken
for some kind of asynchronous API (like POSIX read() can return EAGAIN
if there is no new input yet). It's a state machine, so try to use
appropriate terms.

Signed-off-by: Diego Biurrun <diego@biurrun.de>

Merges Libav commit 8a60bba0ae.
2017-03-09 17:33:56 +01:00
wm4 597c6b789e hls: pass AVFormatContext flags to sub demuxer 2017-03-09 16:24:00 +01:00
wm4 f5da453b06 concatdec: pass AVFormatContext flags to sub demuxer 2017-03-09 16:24:00 +01:00
wm4 fcfc78cbab aacdec: do not mutate input packet metadata
Apparently the demuxer outputs the wrong padding for HE-AAC (based on
the raw sample rate, or so). aacdec contains a hack to adjust the muxer
padding accordingly before it's used to trim the decoder output. This
modified the packet side data, which in combination with the old
decoding API would change the packet the user passed to the decoder.
This is clearly not allowed, and it breaks running some gapless fate
tests with "-fflags +keepside" applied (without keepside, the packet
metadata is typically newly allocated, essentially making a copy and not
modifying the user's input packet).

This should probably be fixed in the demuxer (and consequently also the
muxer), but for now only fix the immediate problem.

Regression since 946ed78f5f (2012).
2017-03-09 10:16:12 +01:00
Muhammad Faiz 53a5cea478 swresample/resample: do not allow odd filter_length
except filter_length == 1

odd filter_length gives worse frequency response,
even when compared with shorter filter_length

also makes build_filter simpler

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-09 13:09:14 +07:00
Michael Niedermayer 3016e919d4 avcodec/wavpack: Fix runtime error: left shift of negative value -5
Fixes: 729/clusterfuzz-testcase-5154831595470848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-08 21:15:07 +01:00
Michael Niedermayer 01a33b835f avcodec/pictordec: Fix runtime error: left shift of 64 by 25 places cannot be represented in type 'int'
Fixes: 724/clusterfuzz-testcase-6738249571631104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-08 21:15:07 +01:00
Muhammad Faiz fe57bf7cd6 fate/swresample: fix FUZZ typo
unintentionally changed to 0.01 at
'61926b6c3e560283ef6c015d6d85c32716942833'

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-08 21:51:02 +07:00
Michael Niedermayer 1d0bad421c avutil/tests/lfg: Remove debugging start/stop timer
Fixes code with qemu ARM

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-08 14:32:00 +01:00
Thomas Turner a50ccbd240 avutil/tests/lfg.c: added proper normality test
The Chen-Shapiro(CS) test was used to test normality for
Lagged Fibonacci PRNG.

Normality Hypothesis Test:

The null hypothesis formally tests if the population
the sample represents is normally-distributed. For
CS, when the normality hypothesis is True, the
distribution of QH will have a mean close to 1.

Information on CS can be found here:

http://www.stata-journal.com/sjpdf.html?articlenum=st0264
http://www.originlab.com/doc/Origin-Help/NormalityTest-Algorithm

Signed-off-by: Thomas Turner <thomastdt@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-08 14:32:00 +01:00
Muhammad Faiz 61926b6c3e swresample/resample: use uniform normalization
this gives better frequency response

update swresample fate and other fates
that depend on resampling

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-08 16:09:38 +07:00
James Almer dbc932e745 Revert "lavu/atomic: add support for the new memory model aware gcc built-ins"
This reverts commit faa9d29829.

This change became superfluous when support for C11 atomics was introduced.
Reverting it will make the removal of this implementation in an upcoming
merge conflict free.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-08 00:48:37 -03:00
Carl Eugen Hoyos 851f4255e0 lsws/slice: Move a misplaced const.
Fixes a gcc warning:
libswscale/slice.c:178:56: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2017-03-08 00:33:21 +01:00
Carl Eugen Hoyos a9c20598b5 lsws/input: Do not define unused functions.
Fixes warnings like the following:
libswscale/input.c:951:13: warning: ‘planar_rgb14be_to_a’ defined but not used
2017-03-08 00:30:06 +01:00
Carl Eugen Hoyos 587226ad45 lavc/libx265: Add gray10 and gray12 encoding support. 2017-03-08 00:25:33 +01:00
Vittorio Giovara 9ae3506696 matroskadec: cosmetics: Rearrange checks for projection-depedendent properties 2017-03-07 17:34:32 -05:00
Vittorio Giovara ac8c72f8f1 mov: Fix checking layout and loading padding for cubemaps 2017-03-07 17:29:52 -05:00
Michael Niedermayer 1afd246960 avcodec/vp8: Check for the bitstream end per MB in decode_mb_row_no_filter()
Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 2 of 2)

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-07 21:29:43 +01:00
Michael Niedermayer 55d7371fe0 avcodec/vp568: Check that there is enough data for ff_vp56_init_range_decoder()
Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 1 of 2)

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-07 21:29:12 +01:00
Michael Niedermayer 5098a6f627 avcodec/vp8: remove redundant check
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-07 19:13:19 +01:00
Vittorio Giovara bde9642268 mkv: Export bounds and padding from spherical metadata
Update the fate test as needed.
2017-03-07 11:28:02 -05:00
Vittorio Giovara 022b4ea583 mov: Export bounds and padding from spherical metadata
Update the fate test as needed.
2017-03-07 11:25:37 -05:00
Vittorio Giovara 1b7ffddb3a spherical: Add tiled equirectangular type and projection-specific properties
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-03-07 11:19:37 -05:00
Muhammad Faiz 776f289c0f avdevice/alldevices: make avdevice_register_all thread safe
use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-07 20:34:44 +07:00
Muhammad Faiz af7010ad05 avfilter/allfilters: make avfilter_register_all thread safe
use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-07 20:34:44 +07:00
Muhammad Faiz 49635f0a46 avfilter/allformats: make av_register_all thread safe
use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-07 20:34:44 +07:00
Muhammad Faiz e85e840880 avcodec/allcodecs: make avcodec_register_all thread safe
use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-07 20:34:44 +07:00
Vittorio Giovara a6b1180e39 avcodec/pixlet: fix architecture-dependent code and values
The constants used in the decoder used floating point precision,
and this caused different values to be generated on different
architectures.

So, eradicate floating point numbers and use fixed point (32.32)
arithmetics everywhere, replacing constants with precomputed integer
values.

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-03-07 14:04:01 +01:00
Aman Gupta b6eaa3928e avcodec/h264, videotoolbox: fix crash after VT decoder fails
The way videotoolbox hooks in as a hwaccel is pretty hacky. The VT decode
API is not invoked until end_frame(), so alloc_frame() returns a dummy
frame with a 1-byte buffer. When end_frame() is eventually called, the
dummy buffer is replaced with the actual decoded data from
VTDecompressionSessionDecodeFrame().

When the VT decoder fails, the frame returned to the h264 decoder from
alloc_frame() remains invalid and should not be used. Before
9747219958, it was accidentally being
returned all the way up to the API user. After that commit, the dummy
frame was unref'd so the user received an error.

However, since that commit, VT hwaccel failures started causing random
segfaults in the h264 decoder. This happened more often on iOS where the
VT implementation is more likely to throw errors on bitstream anomolies.
A recent report of this issue can be see in
http://ffmpeg.org/pipermail/libav-user/2016-November/009831.html

The issue here is that the dummy frame is still referenced internally by the
h264 decoder, as part of the reflist and cur_pic_ptr. Deallocating the
frame causes assertions like this one to trip later on during decoding:

  Assertion h->cur_pic_ptr->f->buf[0] failed at src/libavcodec/h264_slice.c:1340

With this commit, we leave the dummy 1-byte frame intact, but avoid returning it
to the user.

This reverts commit 9747219958.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-07 11:58:38 +01:00
Kagami Hiiragi 734d760e2f lavc/libvpxenc: add -row-mt option
Signed-off-by: James Zern <jzern@google.com>
2017-03-06 11:58:33 -08:00
Michael Niedermayer 8aa4f3bb4f avcodec/proresdec2: Do not discard frames with bad slices
The code previously completely discarded frames that had any error in a slice

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-06 16:47:17 +01:00
Michael Niedermayer 835d9f299c avcodec/x86/cavsdsp: Put MMX code under mmx check
Without this the FPU state becomes trashed and causes mysterious
fate failures with cpuflags=0

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-06 16:47:17 +01:00
Michael Niedermayer a9f9b7f5c7 avcodec/movtextdec: Call mov_text_cleanup() on close
Fixes memleak
Fixes: 548/clusterfuzz-testcase-5511470875934720

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-06 16:47:17 +01:00
wm4 ef86488696 avformat/flvdec: remove meaningless warning
Ever since the codecpar changes, this has been always printed when
opening a flv file. This is because the codecpar changes made all
streams to be added lazily as read_packet is called.
2017-03-06 11:08:03 +01:00
wm4 808ab2fd0b ffmpeg: remove unnecessary hack for decoders which refuse to drain
Now the previous commit takes care of this instead.
2017-03-06 11:08:03 +01:00
wm4 a755b725ec avcodec: consider an error during decoder draining as EOF
There is no reason that draining couldn't return an error or two. But
some decoders don't handle this very well, and might always return an
error. This can lead to API users getting into an infinite loop and
burning CPU, because no progress is made and EOF is never returned.

In fact, ffmpeg.c contains a hack against such a case. It is made
unnecessary with this commit, and removed with the next one. (This
particular error case seems to have been fixed since the hack was
added, though.)

This might lose frames if decoding returns errors during draining.
2017-03-06 11:06:09 +01:00
wang-bin 3267e1703b avcodec/videotoolbox: set kCVPixelBufferOpenGLESCompatibilityKey for iOS
kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey is not available in
iOS
2017-03-06 10:54:02 +01:00
Paul B Mahol 035e932d7c avformat/vivo: fix logic error in checking version in probe
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-03-05 16:34:32 +01:00
Carl Eugen Hoyos 1638d956a3 lavf/matroska: Support QDMC. 2017-03-05 14:41:01 +01:00
Michael Niedermayer ba15005132 avcodec/wavpack: Fix runtime error: left shift of negative value -2
Fixes: 723/clusterfuzz-testcase-6471394663596032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-05 12:03:15 +01:00
Michael Niedermayer 29638d4db9 avcodec/dcadsp: Fix 2 runtime error: signed integer overflow: -1958094138 - 1078906344 cannot be represented in type 'int'
Fixes: 722/clusterfuzz-testcase-5711268868521984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-05 12:01:48 +01:00
Michael Niedermayer d03d386162 avcodec/wavpack: Check bitrate_acc for overflow
Fixes: undefined behavior in 717/clusterfuzz-testcase-5434924129583104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-05 12:01:46 +01:00
Michael Niedermayer fab13bbbcd avcodec/mpeg4videodec: Fix runtime error: signed integer overflow: 134527392 * 16 cannot be represented in type 'int'
This checks the sprite delta intermediates for overflow
Fixes: 716/clusterfuzz-testcase-4890287480504320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-05 12:01:41 +01:00