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

18563 Commits

Author SHA1 Message Date
Michael Niedermayer
115fb6d03e avformat/aviobuf: Fix end check in put_str16()
Fixes out of array read
Fixes: 03c406ec9530e594a074ce2979f8a1f0/asan_heap-oob_7dec26_4664_37c52495b2870a2eaac65f53958e76c1.flac

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-13 03:09:08 +01:00
Carl Eugen Hoyos
405abdbaee lavf/mpjpegdec: Do not call av_log() while probing. 2016-01-12 20:35:03 +01:00
Michael Niedermayer
7c0b84d899 avformat/asfenc: Check pts
Fixes integer overflow
Fixes: 0063df8be3aaa30dd6d76f59c8f818c8/signal_sigsegv_7b7b59_3634_bf418b6822bbfa68734411d96b667be3.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-12 19:57:14 +01:00
Michael Niedermayer
d73f0c586e avformat/asfenc: Flush packet before duration becomes unrepresentable
Fixes: 0063df8be3aaa30dd6d76f59c8f818c8/signal_sigsegv_7b7b59_3634_bf418b6822bbfa68734411d96b667be3.mov
Fixes assertion failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-12 19:30:22 +01:00
Mats Peterson
adef8ee794 lavf/matroskadec: Use av_realloc() in get_qt_codec()
Use av_realloc() rather than av_malloc() when normalizing noncompliant
private data in get_qt_codec().

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-12 14:53:25 +01:00
Ricardo Constantino
d50b5d547f rtmpdh: Initialize gcrypt before using it
Either disabling or init'ing secure memory is required after the use
of gcry_check_version. From a look at the functions rtmpdh uses, I
noticed none require the use of secure memory, so we disable it [1][2].

This resolves some errors returned by rtmpdh code with uninitialized
gcrypt, especifically:
Fatal: failed to create the RNG lock: Invalid argument
FATAL: failed to acquire the FSM lock in libgrypt: Invalid argument

Version "1.5.4" was arbitrarily chosen. An older version probably works
as well, but I couldn't compile older versions to test on my machine.

[1]
https://gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
[2]
https://www.gnupg.org/documentation/manuals/gcrypt/Controlling-the-library.html

Signed-off-by: Ricardo Constantino <wiiaboo@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-12 00:56:02 +01:00
Andreas Cadhalpun
f6e1c96730 ffmdec: change type of len to ptrdiff_t
It is used to store the difference between pointers, so ptrdiff_t is the
correct type.

This prevents potential overflows.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-11 23:14:52 +01:00
Andreas Cadhalpun
63c9b30f98 qtpalette: make the color_* variables unsigned again
This fixes segmentation faults due to out of bounds writes, when
color_start is interpreted as negative number.

This regression was introduced in commit 57631f.

Reviewed-by: Mats Peterson <matsp888@yahoo.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-11 23:14:52 +01:00
Michael Niedermayer
c71999ef97 avformat/dfa: Fix packet leak on error
Fixes: 07fa81f300736485e585b63e7b1cd155/signal_sigabrt_7ffff6ae7cb7_16_94ee815791a1357826524072db5bc2dc.dfa

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-11 17:16:18 +01:00
Mats Peterson
71f73ee325 lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data
This patch adds a new static function get_qt_codec() that takes care of
the initial retrieval of the fourcc and codec ID for A_QUICKTIME and
V_QUICKTIME. It also normalizes noncompliant private data found in some
older files that incorrectly starts with the fourcc by expanding/shifting
the data by 4 bytes, and storing the data size at the start. This is
necessary in order for the rest of the code in the A_QUICKTIME and
V_QUICKTIME blocks (and most likely other code as well) to correctly
parse the private data.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-11 01:35:34 +01:00
Marton Balint
fdb2d4b108 lavf/concatdec: do not access packet if av_read_frame returned error
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-01-10 14:13:16 +01:00
Michael Niedermayer
2039b3e751 avformat: Add integer fps from 31 to 60 to get_std_framerate()
Fixes Ticket 5106

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-09 15:21:34 +01:00
Michael Niedermayer
6e249466cc avformat/movenc: Check that pkt duration is within 32bit range
Durations outside are not supported

Fixes Ticket5114
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-09 03:38:03 +01:00
Michael Niedermayer
5c8467a07c avformat/ivfenc: fix division by zero
Fixes Ticket 5115

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-08 23:27:10 +01:00
Michael Niedermayer
47cd85e1e5 avformat/mov: Simplify format checking code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-08 14:52:53 +01:00
Mats Peterson
6f1466dc52 lavf/matroskadec: A_QUICKTIME and fourcc 0x00000000
In many older QuickTime files, the audio format, or "fourcc", is
0x00000000. The QuickTime File Format Specification states the following
regarding this situation:

"This format descriptor should not be used, but may be found in some
files. Samples are assumed to be stored in either 'raw ' or 'twos'
format, depending on the sample size field in the sound description."

MPlayer handles this logic by itself, but FFmpeg/FFplay currently does
not.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-08 14:52:53 +01:00
Mats Peterson
13d02d3dc8 lavf/mov: Audio and fourcc 0x00000000
In many older QuickTime files, the audio format, or "fourcc", is
0x00000000. The QuickTime File Format Specification states the following
regarding this situation:

"This format descriptor should not be used, but may be found in some
files. Samples are assumed to be stored in either 'raw ' or 'twos'
format, depending on the sample size field in the sound description."

MPlayer handles this logic by itself, but FFmpeg/FFplay currently does
not.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-08 14:52:53 +01:00
Clément Bœsch
5fbe57c027 lavf/uncodedframecrcenc: use FF_CEIL_RSHIFT() 2016-01-07 22:28:08 +01:00
Mats Peterson
6a975cb07f lavf/matroskadec: correct codec_tag for "SMI" SVQ3 files
This corrects the codec_tag for some SVQ3 files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-06 14:45:52 +01:00
Carl Eugen Hoyos
c3c22bee63 lavf/matroskaenc: Assume 48kHz sample rate for Opus initial padding.
Analyzed by Timothy B. Terriberry in Mozilla bug 1227153.
Fixes ticket #5121.
2016-01-05 21:34:35 +01:00
Andreas Cadhalpun
1cb2331eca brstm: fix missing closing brace
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-04 13:44:16 +01:00
Andreas Cadhalpun
bcf4ee26a0 brstm: also allocate b->table in read_packet
This fixes NULL pointer dereferencing if the codec is forced to
adpcm_thp even though a different one was detected.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-04 13:20:09 +01:00
Andreas Cadhalpun
d7d37c479f brstm: make sure an ADPC chunk was read for adpcm_thp
This fixes NULL pointer dereferencing.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-04 13:19:59 +01:00
Mats Peterson
b6c61b7d43 lavf/qtpalette: Ignore greyscale bit in certain cases
The QuickTime File Format Specification states the following:

"Depth: A 16-bit integer that indicates the pixel depth of the
compressed image. Values of 1, 2, 4, 8 ,16, 24, and 32 indicate the
depth of color images. The value 32 should be used only if the image
contains an alpha channel. Values of 34, 36, and 40 indicate 2-, 4-, and
8-bit grayscale, respectively, for grayscale images."

There is no mention of value 33, i.e. 1-bit video (0x01) with the
greyscale bit (0x20) set. I therefore suggest that we ignore the
greyscale bit when processing 1-bit video. Another reason to do this is
that the first 1-bit sample file below will be displayed properly with
blue colors in QuickTime in Windows or Mac *in spite of* the greyscale
bit being set.

Also, QuickTime in Windows or Mac ignores the greyscale bit if the
video sample description contains a palette, regardless of bit depth.
This is undocumented behaviour, but I think we should do the same, and
it seems pretty logical after all, since one wouldn't really bother
putting a customized palette into a grayscale file anyway. See the
second 8-bit sample file below, which has the greyscale bit set, and
which contains a palette in the video sample description. In Windows or
Mac, it will be displayed with the palette in the sample description, in
spite of the greyscale bit being set.

Sample file 1 (1-bit QuickTime Animation):
https://drive.google.com/open?id=0B3_pEBoLs0faTThSek1EeXQ0ZHM
Earth Spin 1-bit qtrle orig.mov

Sample file 2 (8-bit QuickTime Animation):
https://drive.google.com/open?id=0B3_pEBoLs0fad2s0V1YzUWo5aDA
quiz-palette+gs.mov

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-04 03:31:49 +01:00
Andreas Cadhalpun
40eb2531b2 ffmdec: reset packet_end in case of failure
This fixes segmentation faults caused by passing a packet_ptr of NULL to
memcpy.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-03 21:13:01 +01:00
Michael Niedermayer
97c162add7 avformat/ffmdec: Add {} to nested if/else
This preempts potential bugs if this is changed and the indention
ends up different from C interpretation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-03 16:08:32 +01:00
Andreas Cadhalpun
2e752c7de9 ffmdec: change type of state and id to unsigned
This fixes ubsan runtime error: left shift by 8 places cannot be
represented in type 'int'

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-02 20:03:57 +01:00
Hendrik Leppkes
95a2b883e3 Merge commit '69a68593ce5684409c3c4dd9a901bfd8b16925b1'
* commit '69a68593ce5684409c3c4dd9a901bfd8b16925b1':
  Remove stray line breaks from avpriv_{report_missing_feature|request_samples}

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-02 13:20:13 +01:00
Hendrik Leppkes
8a04ddeb47 Merge commit '5049f6b772891cdf4030a9d572362efc8f7ae97f'
* commit '5049f6b772891cdf4030a9d572362efc8f7ae97f':
  rtpdec_jpeg: Coalesce redundant error checks

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-02 13:19:23 +01:00
Andreas Cadhalpun
c112be25f7 oggparsedaala: reject too large gpshift
Also use a unsigned constant for the shift calculation, as 1 << 31 is
undefined for int32_t. This is also fixed oggparsetheora.

This fixes ubsan runtime error: shift exponent is too large for
32-bit type 'int'

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-02 12:00:39 +01:00
Hendrik Leppkes
b966a403dd avcodec/utils: fix AVPacket lifetime in seek_frame_generic
Fixes ticket #5117
2016-01-02 09:27:51 +01:00
Michael Niedermayer
dbfb2c1abf avformat/mp3dec: Remove unused variable
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-01 21:21:10 +01:00
Clément Bœsch
77eeaa2c3d lavf/srtdec: rewrite parsing logic
Fixes Ticket #5032

The samples in Ticket #5032 is using \r\r\n as line breaks.  Since we
already are handling \r, or \n, or \r\n as line breaks, \r\n\n will be
considered as a double line breaks. This is an issue because
ff_subtitles_read_text_chunk() will as a result stop extracting a chunk
after just one line.

So instead of parsing the SRT by "chunks" (which means splitting every
double LB), this new parser is detecting timing lines, and split the
events on this basis. While this sounds safe and simple, it needs to
take into account the event number preceding the timing line while
handling situations such as:

 - event number starting at 0 or actually any number instead of 1
 - event numbers not being ordered at all
 - event number being followed by text garbage (this really happened,
   see Ticket #4898)
 - event payload containing one or multiple number (a protagonist saying
   a count-down, a date or whatever) which could be confused with a
   chapter number
 - event number being empty (see Ticket #2167)
 - all kind of weird line breaks can appear randomly like wild pokémons
 - untrustable line breaks (Ticket #5032)

The sample madness.srt tries to sum up most of this into one sample,
ticket5032-rrn.srt is the file containing \r\r\n line breaks. and
empty-events-2167.srt contains empty events.
2016-01-01 18:31:49 +01:00
Hendrik Leppkes
99f2a56388 Merge commit '64f8c439fd663fec4d57ac21af572d498fe21f7a'
* commit '64f8c439fd663fec4d57ac21af572d498fe21f7a':
  rtmpproto: Include the full path as app when "slist=" is found

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 17:21:32 +01:00
Hendrik Leppkes
5c06fc4bd8 Merge commit '2d0432d918a71468419b7ac1e543ab3b399d3d37'
* commit '2d0432d918a71468419b7ac1e543ab3b399d3d37':
  vocdec: put the code not shared with other demuxers under appropriate ifdef

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 17:14:46 +01:00
Michael Niedermayer
0b1e94c50a Revert "Merge commit '9f1eccb97bf8894cb18b14f642500686505ef186'"
This unbreaks muxing-encoding
Example:
ffmpeg -i matrixbench_mpeg2.mpg new.avi

-rw-r----- 1 michael michael 226035354 Jan  1 16:27 new.avi
-rw-r----- 1 michael michael  10016802 Jan  1 16:28 ref.avi

Also av_get_audio_frame_duration() itself uses frame_size

This reverts commit 29e6606e9b, reversing
changes made to 53448461a7.
2016-01-01 17:05:46 +01:00
Hendrik Leppkes
a78d9abee0 Merge commit '72d658766e6ccf198317dffd6499c5e288847a1c'
* commit '72d658766e6ccf198317dffd6499c5e288847a1c':
  mp3dec: replace avpriv_mpa_decode_header with avpriv_mpegaudio_decode_header

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 16:57:40 +01:00
Hendrik Leppkes
1e96b151fa Merge commit '955aec3c7c7be39b659197e1ec379a09f2b7c41c'
* commit '955aec3c7c7be39b659197e1ec379a09f2b7c41c':
  mpegaudiodecheader: check the header in avpriv_mpegaudio_decode_header

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 16:47:27 +01:00
Hendrik Leppkes
f6728a3ea2 Merge commit '6bf4c1d71199b92894f24db6386ed5070e590a16'
* commit '6bf4c1d71199b92894f24db6386ed5070e590a16':
  r3d: do not create the audio stream until we know the sample rate

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 15:59:30 +01:00
Hendrik Leppkes
29e6606e9b Merge commit '9f1eccb97bf8894cb18b14f642500686505ef186'
* commit '9f1eccb97bf8894cb18b14f642500686505ef186':
  ff_parse_specific_params: do not use AVCodecContext.frame_size

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 15:52:18 +01:00
Hendrik Leppkes
53448461a7 Merge commit '1f008f34d5b2b5f6217521747e7acfe3efc0e666'
* commit '1f008f34d5b2b5f6217521747e7acfe3efc0e666':
  rmenc: do not use AVCodecContext.frame_size

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 15:51:58 +01:00
erankor
3f8564fe3c avformat/mov: support cenc (common encryption)
support reading encrypted mp4 using aes-ctr, conforming to ISO/IEC
23001-7.

a new parameter was added:
- decryption_key - 128 bit decryption key (hex)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-31 16:46:36 +01:00
Michael Niedermayer
389ce22b5f avformat/movenc: Use strict_std_compliance from the muxer layer instead of the encoder layer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-12-30 20:06:04 +01:00
Andreas Cadhalpun
b4466c9c1a oggparsedaala: check number of planes in pixel format map
This fixes crashes caused by out-of-bounds writes.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-29 18:42:14 +01:00
Mats Peterson
bd03ee1184 lavf/qtpalette: Treat 1-bit video as palettized
This commit for qtpalette.c and qtpalette.h adds 1-bit video to the
"palettized video" category, since if the video sample description
contains a palette, the two colors in the palette can be any color, not
necessarily black & white.

Unfortunately, I've noticed that the qtrle (QuickTime Animation) decoder
blindly assumes that 1-bit video is black & white. I don't have enough
knowledge about the decoder to fix this, though.

Below is a link to a sample 1-bit QuickTime Animation clip of a rotating
earth that uses blueish colors, and they will be correctly rendered in
QuickTime, but not in FFmpeg (which will use black & white).

https://drive.google.com/open?id=0B3_pEBoLs0faUlItWm9KaGJSTEE

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-29 13:12:18 +01:00
Rodger Combs
1b5bd4051d lavf/mpegtsenc: add automatic bitstream filtering 2015-12-28 08:40:37 -06:00
Rodger Combs
b287d7ea17 lavf/matroskaenc: add automatic bitstream filtering 2015-12-28 08:40:37 -06:00
Rodger Combs
822e80fde3 lavf: add internal API to append a bsf to a stream's list 2015-12-28 08:40:37 -06:00
Rodger Combs
1f9139b07b lavf: add automatic bitstream filtering; bump version
This solves the problem discussed in https://ffmpeg.org/pipermail/ffmpeg-devel/2015-September/179238.html
by allowing AVCodec::write_header to be delayed until after packets have been
run through required bitstream filters in order to generate global extradata.

It also provides a mechanism by which a muxer can add a bitstream filter to a
stream automatically, rather than prompting the user to do so.
2015-12-28 08:40:35 -06:00
Rodger Combs
7a161b74ad lavf/tee: use lavf API for applying bitstream filters 2015-12-28 08:37:39 -06:00