Commit Graph

91277 Commits

Author SHA1 Message Date
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
Jan Ekström 26892c7615 lavf/libssh: translate a read of 0 to EOF
Yet another case of forgotten 0 =! EOF translation.

While the documentation for this specific synchronous read
function does not mention it, the documentation for
`sftp_async_read` documents it, as well as looking at the
implementation of this function leads one to find
`if (handle->eof) { return 0; }`.

Reported by stnutt on IRC.
2018-05-28 20:33:50 +03:00
Jun Zhao 81b77e7bf1 cmdutils: dump supported hardware devices in print_codec()
dump the supported hardware devices for codec when use the command
like ./ffmpeg -h decoder=h264.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-05-28 18:21:48 +08:00
Jun Zhao 90acf168a6 cmdutils: print missing caps in print_codec().
print full caps type in print_codec().

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-05-28 18:21:35 +08:00
Karthick Jeyapal ebf85d3190 avformat/dashenc: Added a warning for incorrect segment name extension
Applicable only to webm output format.
By default all the segment filenames end with .m4s extension.
When someone chooses webm output format, we recommend they also override the relevant segment name options to end with .webm extension. This patch will issue a warning for he same
2018-05-28 10:52:07 +05:30
Karthick Jeyapal 2efdbf7367 avformat/dashenc: Added option for Segment file format
Right now segment file format is chosen to be either mp4 or webm based on the codec format.
This patch makes that choice configurable by the user, instead of being decided by the muxer.

Also with this change per-stream choice segment file format(based on codec type) is not possible.
All the output audio and video streams should be in the same file format.
2018-05-28 10:52:01 +05:30
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
Michael Niedermayer df3d962d2e libavformat/mxfenc: Add some () to attempt to workaround build issue on osx
fixes ticket7209

Tested-by: Jim DeLaHunt <from.ffmpeg-dev@jdlh.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 21:38:33 +02:00
Michael Niedermayer 1386a199f9 configure: Omit fsanitize flags if they are already specified by the user
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-27 21:38:33 +02:00
Reino Wijnsma 0263c52f4d configure: fix check for mbedtls
Add missing libraries needed when linking with a static build of MbedTLS.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-05-27 16:18:18 -03:00
Marton Balint 2b05981312 avformat/mxf: fix NTSC 59.94 samples per frame layout
FFmbc uses this.
bmx uses this.
XAVC MXF Mapping and Operating Points prefers this.
Basic rounding rules also yields these numbers.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-05-27 19:55:09 +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 42b4351333 lavf/img2dec: Auto-detect xwd images. 2018-05-25 20:06:34 +02:00
Carl Eugen Hoyos 7c333dc6a7 doc/codecs: Remove option sc_factor.
Fixes ticket #7228.
The option was disabled since 4a62f477 and removed in 6e69525e.
2018-05-24 18:23:53 +02:00
Steven Liu 50df4c958b avformat/hlsenc: support http method for hls fmp4
fix ticket: 7160

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-05-24 11:55:58 +08:00
Steven Liu 04b6060616 avformat/dashdec: replace user-agent to user_agent for deprecate warning message 2018-05-24 11:49:04 +08:00
Colin NG 93fc96e199 avformat/dashdec: Fix for ticket 7149 (Segfault when decoding dash streams)
simplify the code to check common init section
2018-05-24 11:49:00 +08:00
Colin NG 9aee574dd0 avformat/dashdec: Fix for ticket 7149 (Segfault when decoding dash streams)
Add NULL pointer check for init_section
2018-05-24 11:48:39 +08:00
Mark Thompson 8ef51a4092 hwcontext_vaapi: Fix mapping from DRM
This was broken by bed670a1de, which added
an assert that always failed.
2018-05-24 01:20:31 +01:00
Michael Niedermayer fe84f70819 avformat/mov: replace a value error by clipping into valid range in mov_read_stsc()
Fixes: #7165

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-22 21:05:45 +02:00
Michael Niedermayer 919e37377a avformat/bintext: Reduce detection for random .bin files as it more likely is not a multimedia related file
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-22 21:05:45 +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
Thomas Volkert c24d247e2c libavformat: add mbedTLS based TLS
Signed-off-by: James Almer <jamrial@gmail.com>
2018-05-21 19:43:04 -03: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
Mark Thompson ba7d1377e8 hwcontext: Add test for device creation and derivation
This uses any devices it can find on the host system - on a system with no
hardware device support or in builds with no support included it will do
nothing and pass.
2018-05-21 20:54:52 +01:00
Aman Gupta 70d25268c2 avformat/mpegts: fix memory leak with merge_pmt_versions=1
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-21 12:16:06 -07:00
Aman Gupta fc2daf36f9 doc: remove AVStream private fields from APIchanges
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-21 12:13:14 -07:00
Aman Gupta 64680fff3b avformat/mpegts: rename variable to clarify meaning
Both stream_id and stream_identifier are used in this file,
and have different meanings. The latter comes from the
stream_identifier_descriptor.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-21 12:13:14 -07:00
Michael Niedermayer 2c2d689c56 avformat/mov: Only fail for STCO/STSC contradictions if both exist
Fixes regression with playback of GF9720Repeal20the20Eighth20with20Helen20Linehan.m4a
See: crbug 822666

Found-by: "Mattias Wadman <mattias.wadman@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-21 01:50:21 +02:00
Michael Niedermayer 56e76bd057 avformat/mov: Break out early if chunk_count is 0 in mov_build_index()
Without this some operations might overflow (undefined behavior)
even though the index adding loop would never execute

No testcase known

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-21 01:38:56 +02: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
Michael Niedermayer cadf7a7f39 avformat/mp3dec: require 90% of a file to be mp3 if only 1 mp3 frame is found in sequence
This eliminates several low score detections of non mp3 files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-20 13:17:36 +02:00
Michael Niedermayer 81b3e7c9c3 avformat/mp3dec: Require 50% of the file to be mp3 frames in the maxframes>200 probing test
This corrects several misdetections of large files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-20 13:17:36 +02:00
Michael Niedermayer 60d1792779 avformat/mp3dec: Require probing data to be 50% mp3 frames for low score probing to succeed
This massively reduces the detection of random data as low score mp3
It may improve security by making it harder to read non multimedia data

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-20 13:17:36 +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
Martin Vignali 411f7141a3 avdevice/sdl2 : add option to define if the window quit action is available 2018-05-19 14:55:15 +02:00