1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

40439 Commits

Author SHA1 Message Date
Jun Zhao
4030d3d3f4 lavc/dolby_e: fix make checkheaders warning
move the the function init_tables() definitions from header file
to .c file to fix make checkheaders warning.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-10 08:46:09 +08:00
Marton Balint
d070d6f69d avcodec/avcodec.h: add AV_CODEC_ID_TTML
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-08 23:21:18 +02:00
Michael Niedermayer
f2abd36b38 avcodec/shorten: Fix multiple integer overflows
Fixes: signed integer overflow: 3 * 1006632960 cannot be represented in type 'int'
Fixes: 8278/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5692857166856192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-07 19:52:57 +02:00
Michael Niedermayer
606c714823 avcodec/shorten: Fix undefined shift in fix_bitshift()
Fixes: left shift of negative value -9
Fixes: 8571/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5715966875926528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-07 19:52:57 +02:00
Michael Niedermayer
a711efe922 avcodec/shorten: Fix a negative left shift in shorten_decode_frame()
Fixes: left shift of negative value -9057
Fixes: 8527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5666853924896768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-07 19:52:57 +02:00
Michael Niedermayer
d91a0b503d avcodec/shorten: Sanity check nmeans
Fixes: OOM
Fixes: 8195/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5179785826271232

The reference software appears to use longs for 32bits and it uses int for nmeans
hinting that the intended maximum size was not 32bit.

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-07 19:52:57 +02:00
Carl Eugen Hoyos
c8de4448bd lavc/profiles: Mention AAC-LC only once. 2018-06-06 22:36:25 +02:00
Michael Niedermayer
424a81df10 avcodec/shorten: Check non COMM chunk len before skip in decode_aiff_header()
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 8024/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5109204648984576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-06 16:58:08 +02:00
Michael Niedermayer
936f4a2c2e avcodec/mjpegdec: Fix integer overflow in ljpeg_decode_rgb_scan()
Fixes: signed integer overflow: 32768 + 2147450880 cannot be represented in type 'int'
Fixes: 7885/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-5298834394578944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-06 16:58:08 +02:00
Michael Niedermayer
79c6047c36 avcodec/truemotion2: Fix overflow in tm2_apply_deltas()
Fixes: signed integer overflow: 1077952576 + 1077952576 cannot be represented in type 'int'
Fixes: 7712/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5056281753681920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-06 16:58:08 +02:00
Paul B Mahol
ddf6ff9dc6 avcodec/magicyuvenc: mark as not more experimental
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-05 11:28:48 +02:00
Paul B Mahol
4d93c63e78 avcodec/magicyuvenc: write max huffman length and extradata too
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-05 11:15:49 +02:00
Michael Niedermayer
e7dda51150 avcodec/opus_silk: Change silk_lsf2lpc() slightly toward silk/NLSF2A.c
Fixes: runtime error: signed integer overflow: -1440457022 - 785819492 cannot be represented in type 'int'
Fixes: 7700/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OPUS_fuzzer-6595838684954624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-04 23:47:55 +02:00
Michael Niedermayer
dce80a4b47 avcodec/amrwbdec: Fix division by 0 in find_hb_gain()
This restructures the code slightly toward D_UTIL_dec_synthesis()

Fixes: 7420/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMRWB_fuzzer-6577305112543232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-04 23:47:51 +02:00
Jerome Borsboom
f56a0b02cd avcodec/vc1: fix out-of-bounds reference pixel replication
Out-of-bounds reference pixel replication should take into account the frame
coding mode of the reference frame(s), not the frame coding mode of the
current frame.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-06-04 16:32:57 +02:00
Mark Thompson
2bd24d4a37 v4l2_m2m: Mark V4L2 M2M decoders as unsuitable for probing 2018-06-03 18:40:26 +01:00
Michael Niedermayer
5ee203076f avcodec/vp3: Fix end of bitstream check in unpack_superblocks()
Fixes: regression

Found-by: Frank Liberato <liberato@google.com>
Tested-by: Frank Liberato <liberato@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-02 21:46:40 +02:00
Gyan Doshi
841c1efc78 lavc/libx265: allow users to set closed GOP via generic lavc flag
lavc flag 'cgop' can be used to set closed GOP.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2018-06-02 00:41:44 +05:30
Jérôme Martinez
5205b3289e avcodec/dpx: Support for RGBA 12-bit packed decoding
Limited to widths multiple of 2 due to lack of test files for such corner case

This partially fixes ticket #5639
2018-06-01 11:25:23 +02:00
Paul B Mahol
0d35413e5d avcodec/dnxhdenc: do not free nonexistent slice threads data when frame threading is used
Forgotten in 28e9ba951d.
Fixes #7241.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-01 10:54:39 +02:00
Michael Niedermayer
44a2415a6d avcodec/h263dec: Reinitialize idct context if it has not been setup for the active profile
The profile after reading headers can be different from when the context was initialized

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-30 17:58:08 +02:00
Michael Niedermayer
8c50d0cccf avcodec/idctdsp: Clear idct/idct_add for studio profile
This does not leave them "as before" which may be a value from a previous profile

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-30 17:58:08 +02:00
Michael Niedermayer
b3332a182f avcodec/idctdsp: Transmit studio_profile to init instead of using AVCodecContext profile
These 2 fields are not always the same, it is simpler to always use the same field
for detecting studio profile

Fixes: null pointer dereference
Fixes: ffmpeg_crash_3.avi

Found-by: Thuan Pham <thuanpv@comp.nus.edu.sg>, Marcel Böhme, Andrew Santosa and Alexandru RazvanCaciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-30 17:58:08 +02:00
Michael Niedermayer
a9dacdeea6 avcodec/qtrle: Do not output duplicated frames on insufficient input
This improves performance and makes qtrle behave more similar to other decoders.
Libavcodec does generally not output known duplicated frames, instead the calling Application
can insert them as it needs.

Fixes: Timeout
Fixes: 6383/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QTRLE_fuzzer-6199846902956032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-30 02:42:10 +02:00
Jerome Borsboom
8a4dbd3e9f avcodec/vc1: store zero MVs for all blocks in a MB
Direct prediction for interlace frame B pictures references the mv in the
second block in an MB in the backward reference frame for the twomv case.
When the backward reference frame is an I frame, this value may be unset.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-05-28 23:50:28 +02:00
Jerome Borsboom
c0402e1e30 avcodec/vc1: fix mquant calculation for interlace field pictures
For interlace field pictures s->mb_height indicates the height of the full
picture in MBs, i.e. the two fields combined. A single field is half this
size. When calculating mquant for interlace field pictures, the bottom edge
is the last MB row of the field.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-05-28 23:38:49 +02:00
Michael Niedermayer
42f40d36b7 avcodec/allcodecs: Provide empty codec_list in allcodecs when ossfuzz is used
The last workaround is not sufficient to make oss fuzz work with the iterate API
as it did not provide a FFmpeg that external libs can be linked to.

This patch does not fully restore the pre iterate functionality. My attempts to
do this have so far failed.

The problem with this solution is that it renders the fuzzers virtual system
ffmpeg (libs) non functional. Which differs from a real system compared to the
virtual system tested by the fuzzer.
It should theoretically not matter as the system ffmpeg wouldnt be used.
But with more cases being fuzzed we likely will hit a case where a external
lib is involved and it does matter ...

Working around this may be possible with weak symbols but so far my attempts
failed

Alternatively multiple ffmpeg could be built, this becomes messy though
quickly as they need to be all linked together. That is we need a FFmpeg
that has the iterate API modified so it can work with the resources
available to ossfuzz. And at the same time we need a ffmpeg that has
its full functionality for any external libs which use ffmpeg and are
used by ffmpeg.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-28 23:17:32 +02:00
Michael Niedermayer
e3275f937d avcodec/ac3dec: Check that the number of channels with dependant streams is valid
Fixes: left shift of 1 by 63 places cannot be represented in type 'long long'
Fixes: out of array access
Fixes: 7284/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_fuzzer-5767914968842240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 23:10:12 +02:00
Michael Niedermayer
e3f656f2de avcodec/ac3dec: Fix null pointer dereference in ac3_decode_frame()
Fixes: index 8 out of bounds for type 'uint8_t *[8]'
Fixes: 7273/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-6296497667702784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 23:10:12 +02:00
Michael Niedermayer
90475db97e avcodec/aacdec_fixed: use 64bit to avoid overflow in rounding in apply_dependent_coupling_fixed()
Fixes: signed integer overflow: -2141499320 + -14469590 cannot be represented in type 'int'
Fixes: 7351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-6351214791884800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 23:10:12 +02:00
Michael Niedermayer
62cb6fadf3 oavcodec/aacpsdsp_template: Use unsigned for hs0X to prevent undefined behavior
Fixes: signed integer overflow: 1073741842 + 1784008138 cannot be represented in type 'int'
Fixes: 6792/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5677589835284480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 23:10:12 +02:00
Michael Niedermayer
53f241218d avcodec/g723_1dec: Clip bits2 in both directions
Fixes: shift exponent 33 is too large for 32-bit type 'int'
Fixes: 6743/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G723_1_fuzzer-5823772687859712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 23:10:12 +02:00
Michael Niedermayer
e1182fac1a avcodec/mpeg4videoenc: Use 64 bit for times in mpeg4_encode_gop_header()
Fixes truncation
Fixes Assertion n <= 31 && value < (1U << n) failed at libavcodec/put_bits.h:169
Fixes: ffmpeg_crash_2.avi

Found-by: Thuan Pham <thuanpv@comp.nus.edu.sg>, Marcel Böhme, Andrew Santosa and Alexandru RazvanCaciulescu with AFLSmart

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 23:10:12 +02:00
Carl Eugen Hoyos
fbb283cfef lavc/hevcdec: Treat clean random access nals as keyframes for -skip_frame.
Fixes ticket #7227.

Reviewed-by: Mark Thompson
2018-05-27 22:51:06 +02:00
Gagandeep Singh
9cefb9e7ec lavc/cfhd: interlaced frame decoding added
ticket #5522 output of given samples significantly improved
2018-05-27 15:16:45 +01:00
Michael Niedermayer
63c4a4b0d6 avcodec/mlpdec: Only change noise_type if the related fields are valid
Fixes: inconsistency
Fixes:runtime error: index 8 out of bounds for type 'int32_t [8]'
Fixes: 6686/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5191383498358784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-26 00:54:55 +02:00
Michael Niedermayer
10c8521265 indeo4: Decode all or nothing of a band header.
This avoids inconsistent value combinations.
Alternatively it would be possible to add more checks and careful use of
temporary variables, but my try of this quickly seemed to become
a rather large change.
The disadvantage of this, is that the struct is copied back and forth.

Fixes: index 6 out of bounds for type 'const uint16_t [5][16]'
Fixes: 6557/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-4787296550256640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-26 00:54:55 +02:00
Michael Niedermayer
f77eee67e2 avcodec/ac3dec: Use frame_size if superframe_size is 0
Fixes: Infinite loop
Fixes: 7669/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-4689042185650176
Fixes: 7670/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_AC3_fuzzer-4706306762997760
Fixes: 7672/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-4702108499574784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-26 00:54:55 +02:00
Carl Eugen Hoyos
085fe9822d lavc/hevc_ps: Use correct pix_fmt AV_PIX_FMT_GRAY9 for 9-bit 4:0:0 input. 2018-05-25 20:46:11 +02:00
Carl Eugen Hoyos
7b51b8020c lavc/j2kenc: Support AV_PIX_FMT_PAL8. 2018-05-25 20:09:22 +02:00
Carl Eugen Hoyos
1083808c48 lavc/jpeg2000dec: Move a variable declaration closer to its usage. 2018-05-22 12:55:46 +02:00
Carl Eugen Hoyos
848ce6f0a6 lavc/jpeg2000dec: Use a define to clarify the meaning of a constant. 2018-05-22 12:54:32 +02:00
Carl Eugen Hoyos
15f50ccc6f lavc/h264_parse: Remove a superfluous linebreak. 2018-05-22 12:48:53 +02:00
James Almer
27df34bf1f avcodec/libvpxenc: fix setting amount of threads used for encoding
The libvpx doxy says that a value of 0 for the g_threads field is
equivalent to a value of 1, whereas for avctx->thread_count it means
the maximum amount of threads possible for the host system.

Use av_cpu_count() to get the correct thread count when auto threads
is requested.

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-05-21 18:52:31 -03:00
Jerome Borsboom
fac5849915 avcodec/vc1: FIELDTX is only present in interlaced frame I/BI pictures
If v->fieldtx_is_raw is not reset to zero, it may spill over from a previous
interlaced frame I/BI picture.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-20 23:56:30 +02:00
Jerome Borsboom
2b86472a65 avcodec/vc1: fix calculation of the last line of a slice
Only for the last slice of the first field is the last line of the slice
equal to the height of the field.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-20 13:17:36 +02:00
Jerome Borsboom
ca878845ae avcodec/vc1: DIRECTBIT is only present in inter MBs
DIRECTBIT was decoded before the intra/inter MB branching when decoding
interlace frame B pictures. Resulting in mistakenly also decoding it for intra
MBs where this syntax element is not present.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-20 13:17:36 +02:00
Aman Gupta
8f146b526f avcodec/videotoolbox: fix decoding of some HEVC videos
In a normal hwaccel, the AVHWFramesContext sets AVFrame.hw_frames_ctx
when it initializes a new AVFrame in av_hwframe_get_buffer().

But the VT hwaccel doesn't know what hw_frames_ctx to assign when
the AVFrame is first created, because it depends on the format of
the pixbuf that the decoder eventually decides to return. Thus
newly created AVFrames always have a NULL hw_frames_ctx, and the
hwaccel would only assign the ctx once a frame was done decoding.
This worked fine with the H264 decoder, but with the HEVC decoder
the frame's data may be moved to another empty AVFrame. Since the
empty AVFrame never had hw_frames_ctx set, a frame with a NULL
ctx could be returned to the API user.

This patch works around the issue by moving the derived
hw_frames_ctx from the AVFrame to a new VTHWFrame which now holds
both the CVPixelBufferRef and the AVBuffer. The hw_frames_ctx
is only copied to the AVFrame right before it is about to be
returned to the user in videotoolbox_postproc_frame() (since
in the case of VT, the hw_frames_ctx is only there for the API
user anyway).

Fixes playback on macOS and iOS of some hevc videos like
https://s3.amazonaws.com/tmm1/videotoolbox/germany-hevc-zdf.ts

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-18 12:38:51 -07:00
Rostislav Pehlivanov
8e7b13b971 opusenc: use for loops with declarations
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-05-18 02:38:08 +01:00
Carl Eugen Hoyos
380ca1bc0c lavc/v210dec: Skip Canopus C210 extradata.
Unbreaks files with unknown extradata, the Canopus decoder accepts both files
with and without this extradata (24 byte "INFO", 16 byte "RDRT", rest "FIEL").

Reported-by: Peter Bubestinger
Tested-by: Piotr Bandurski
2018-05-17 12:19:38 +02:00