Commit Graph

20085 Commits

Author SHA1 Message Date
Paul B Mahol
c948414876 avformat: add Gremlin Digital Video demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-11 10:00:39 +02:00
Sasi Inguva
93db5e3fc4 lavf/mov.c: offset index timestamps by the minimum pts to make first pts zero
If the videos starts with B frame, then the minimum composition time
as computed by stts + ctts will be non-zero. Hence we need to shift
the DTS, so that the first pts is zero. This was the intention of that
code-block. However it was subtracting by the wrong amount.

For example, for one of the videos in the bug nonFormatted.mp4 we have

stts:
sample_count  duration
960           1001

ctts:
sample_count  duration
1             3003
2             0
1             3003
....

The resulting composition times are :  3003, 1001, 2002, 6006, ...

The minimum composition time or PTS is 1001, which should be used to
offset DTS. However the code block was wrongly using ctts[0] which is
3003. Hence the PTS was negative. This change computes the minimum pts
encountered while fixing the index, and then subtracts it from all the
timestamps after the edit list fixes are applied.

Samples files available from:

https://bugs.chromium.org/p/chromium/issues/detail?id=721451
https://bugs.chromium.org/p/chromium/issues/detail?id=723537

fate-suite/h264/twofields_packet.mp4 is a similar file starting with 2
B frames. Before this change the PTS of first two B-frames was -6006
and -3003, and I am guessing one of them got dropped when being decoded
and remuxed  to the framecrc before, and now it is not being dropped.

Signed-off-by: Sasi Inguva <isasi@google.com>
2017-06-09 18:13:33 +02:00
raymondzheng
9f20cc5c84 libavformat/http: return EIO when ffurl_read return 0, but s->off < target_end
Approved-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-09 13:27:44 +02:00
wm4
66cf78e932 lavf: consider codec framerate for framerate detection
Fixes detection of some TV sample as 24.5 FPS. With the patch applied,
it's detected as 25 FPS.

This is enabled for mpegts only.
2017-06-07 11:08:06 +02:00
Michael Niedermayer
850cbd496f avformat/utils: Slightly un-clutter code in determinable_frame_size() by using a switch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-06 18:31:47 +02:00
Michael Niedermayer
189ff42196 avformat/hls: Check local file extensions
This reduces the attack surface of local file-system
information leaking.

It prevents the existing exploit leading to an information leak. As
well as similar hypothetical attacks.

Leaks of information from files and symlinks ending in common multimedia extensions
are still possible. But files with sensitive information like private keys and passwords
generally do not use common multimedia filename extensions.
It does not stop leaks via remote addresses in the LAN.

The existing exploit depends on a specific decoder as well.
It does appear though that the exploit should be possible with any decoder.
The problem is that as long as sensitive information gets into the decoder,
the output of the decoder becomes sensitive as well.
The only obvious solution is to prevent access to sensitive information. Or to
disable hls or possibly some of its feature. More complex solutions like
checking the path to limit access to only subdirectories of the hls path may
work as an alternative. But such solutions are fragile and tricky to implement
portably and would not stop every possible attack nor would they work with all
valid hls files.

Developers have expressed their dislike / objected to disabling hls by default as well
as disabling hls with local files. There also where objections against restricting
remote url file extensions. This here is a less robust but also lower
inconvenience solution.
It can be applied stand alone or together with other solutions.
limiting the check to local files was suggested by nevcairiel

This recommits the security fix without the author name joke which was
originally requested by Nicolas.

Found-by: Emil Lerner and Pavel Cheremushkin
Reported-by: Thierry Foucu <tfoucu@google.com>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-05 13:55:01 +02:00
Michael Niedermayer
c0702ab830 Revert "avformat/hls: Check local file extensions"
Requested-by: Paul B Mahol <onemda@gmail.com>
This reverts commit caf7d6178a.
2017-06-05 13:55:01 +02:00
Sysiphus
caf7d6178a avformat/hls: Check local file extensions
This reduces the attack surface of local file-system
information leaking.

It prevents the existing exploit leading to an information leak. As
well as similar hypothetical attacks.

Leaks of information from files and symlinks ending in common multimedia extensions
are still possible. But files with sensitive information like private keys and passwords
generally do not use common multimedia filename extensions.
It does not stop leaks via remote addresses in the LAN.

The existing exploit depends on a specific decoder as well.
It does appear though that the exploit should be possible with any decoder.
The problem is that as long as sensitive information gets into the decoder,
the output of the decoder becomes sensitive as well.
The only obvious solution is to prevent access to sensitive information. Or to
disable hls or possibly some of its feature. More complex solutions like
checking the path to limit access to only subdirectories of the hls path may
work as an alternative. But such solutions are fragile and tricky to implement
portably and would not stop every possible attack nor would they work with all
valid hls files.

Developers have expressed their dislike / objected to disabling hls by default as well
as disabling hls with local files. There also where objections against restricting
remote url file extensions. This here is a less robust but also lower
inconvenience solution.
It can be applied stand alone or together with other solutions.
limiting the check to local files was suggested by nevcairiel

Found-by: Emil Lerner and Pavel Cheremushkin
Reported-by: Thierry Foucu <tfoucu@google.com>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-05 03:03:11 +02:00
James Almer
3d40263253 avformat/aacdec: add a custom read_packet function
Atempt to read and propagate only full ADTS frames and not other data,
like id3v1 or APETags at the end of the file.

Fixes ticket #6437.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-06-04 11:52:02 -03:00
Marton Balint
880504814a avformat/utils: change bitrate to int64_t in av_find_best_stream
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-06-04 15:02:53 +02:00
Marton Balint
47c699f7be avformat/utils: return impaired streams in av_find_best_stream if only those exist
Fixes ticket #6397.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-06-04 15:02:53 +02:00
Michael Niedermayer
53e0d5d724 avformat/options: log filename on open
The loglevel is choosen so that the main filename and any images of
multi image sequences are shown only at debug level to avoid
clutter.

This makes exploits in playlists more visible. As they would show
accesses to private/sensitive files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-03 23:14:04 +02:00
James Almer
2ba896fef7 avformat/matroskaenc: also write chapters when output is WebM
WebM supports a subset of elements from the Chapters master.
See https://www.webmproject.org/docs/container/#chapters

Addresses ticket #6425

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-06-02 20:44:53 -03:00
wm4
3da13fd6ac avformat/tls_schannel: log unknown error codes 2017-05-31 12:07:43 +02:00
Michael Niedermayer
a5d849b149 avformat/avidec: Limit formats in gab2 to srt and ass/ssa
This prevents part of one exploit leading to an information leak

Found-by: Emil Lerner and Pavel Cheremushkin
Reported-by: Thierry Foucu <tfoucu@google.com>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-31 02:32:42 +02:00
Michael Niedermayer
78f6ec32a3 avformat/avidec: Fix txts fmts parsing
Fixes: subtitle.avi from vlc/ticket/1162

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-31 02:32:42 +02:00
Rostislav Pehlivanov
a3deeaade3 lavf: remove the libnut library wrapper
libnut is outdated and not developed anymore, all nut developments
happens in this repo, so users are getting mislead
2017-05-29 20:15:58 +01:00
Micah Galizia
c4c73020f4 libavformat/hls: Observe Set-Cookie headers
Signed-off-by: Micah Galizia <micahgalizia@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-29 02:00:08 +02:00
erankor
15bd309af8 movenc: encryption with time code track fix
instead of deciding whether to encrypt based on the encryption scheme,
decide according to whether cenc was initialized or not.
mov_create_timecode_track calls ff_mov_write_packet with a track that
doesn't have cenc initialized.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-28 03:05:59 +02:00
James Almer
24133973fc avformat/mov: add support for reading Content Light Level Box
As defined in "VP Codec ISO Media File Format Binding v1.0"
https://github.com/webmproject/vp9-dash/blob/master/VPCodecISOMediaFileFormatBinding.md

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-27 16:14:24 -03:00
James Almer
ab05bd6e6c avformat/mov: add support for reading Mastering Display Metadata Box
As defined in "VP Codec ISO Media File Format Binding v1.0"
https://github.com/webmproject/vp9-dash/blob/master/VPCodecISOMediaFileFormatBinding.md

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-27 16:09:55 -03:00
Michael Niedermayer
1a36354698 avformat/mux: Fix copy an paste typo
Found-by: Roger Scott <rscott@grammatech.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-27 04:21:34 +02:00
James Almer
437ad467c2 avformat/mux: remove autobsf extradata propagation hack
The offending bitstream filter was fixed, so this is no longer needed.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:28:00 -03:00
James Almer
210388a197 avcodec/adtsenc: check packet side data for AAC extradata updates
This is in preparation for the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:28:00 -03:00
James Almer
8b3ec51de8 avformat/latmenc: check packet side data for AAC extradata updates
This is in preparation for a following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:28:00 -03:00
James Almer
7631f14bb3 avformat/matroskaenc: check packet side data for AAC extradata updates
This adapts and merges commit f4bf236338
from libav, originally skipped in 13a211e632
as it was not necessary back then.

Is's applied now in preparation for the following patches, where the
aac_adtstoasc bitstream filter will start to correctly propagate the new
extradata through packet side data.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:27:59 -03:00
James Almer
f8c73e8753 avformat/movenc: always check for new extradata on a packet
Don't just look at zero sized packets, and also check for AAC extradata
updates, in preparation for the following patches.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:27:59 -03:00
Clément Bœsch
ef01061225 lavf/hls: do not transfer custom IO flag
See 0dcac9c3f0
2017-05-22 17:31:32 +02:00
Clément Bœsch
0dcac9c3f0 lavf/concatdec: do not transfer custom IO flag
If the source is using a custom IO, setting this flag causes heavy leaks
since the segments will not have their avio context closed.

Regression since f5da453b06.
2017-05-22 16:55:30 +02:00
Hendrik Leppkes
9fb293cfd8 Use AVOnce as a static variable consistently
Using AVOnce as a stack variable makes no sense as the state is lost
when the function exits.

This fixes repeated calls to av(filter/device)_register_all
2017-05-22 12:36:32 +02:00
Carl Eugen Hoyos
7f60dc03a0 lavf/img2: Add svg and svgz to allow reading image sequences.
Increase the return value for svg_probe() to make it != AVPROBE_SCORE_EXTENSION.
2017-05-22 01:09:21 +02:00
Carl Eugen Hoyos
017a68e8fb lavf/riff: Support more vlc fourcc's for 12 and 16 bit yuv4xx. 2017-05-21 23:39:54 +02:00
Clément Bœsch
1a950f32ab Merge commit 'e519dcd937c7c98815ba9884867590e302272016'
* commit 'e519dcd937c7c98815ba9884867590e302272016':
  dashenc: separate segments based on current segment duration

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:55:22 +02:00
Clément Bœsch
e815111367 Merge commit '1920382aa9f21d7ed1a3c2214990da8d2b067a92'
* commit '1920382aa9f21d7ed1a3c2214990da8d2b067a92':
  dashenc: add option to provide UTC timing source

Also use E instead of AV_OPT_FLAG_ENCODING_PARAM to be consistent with
the other AVOption.

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:53:36 +02:00
Clément Bœsch
ba3adea957 Merge commit '3c2717e48dd8c5115f2be35c2afcabd8a1f67aee'
* commit '3c2717e48dd8c5115f2be35c2afcabd8a1f67aee':
  dashenc: increase buffer time hint in the manifest

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:39:10 +02:00
Clément Bœsch
77a20cff36 Merge commit '95f1004bdfdf2d26c330c1d4b7c4ac9352d60b18'
* commit '95f1004bdfdf2d26c330c1d4b7c4ac9352d60b18':
  dashenc: add mandatory id to AdaptationSet and Period in manifest

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:37:04 +02:00
Clément Bœsch
93bf0480c2 Merge commit '1ae6cb7d6e4fee30754a46bc91f40ff75ac4412a'
* commit '1ae6cb7d6e4fee30754a46bc91f40ff75ac4412a':
  dashenc: fix ISO8601 UTC parsing

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-20 16:32:20 +02:00
Matthieu Bouron
ab61b79b1c lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out
Some samples have their metadata track time_scale incorrectly set to 0
and the check introduced by a398f054fd
prevents playback of those samples. Setting the time_scale to 1 fixes
playback.
2017-05-20 12:56:35 +02:00
Michael Niedermayer
0cc6dd1b81 avformat/id3v2: Use ffio_ensure_seekback() in id3v2_read_internal()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-19 21:14:26 +02:00
Michael Niedermayer
7383a835e4 avformat/aviobuf: Only downscale the buffer once it has been used
The code mistook the first iteration sometimes as the end

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-19 21:14:26 +02:00
James Almer
5ff31babfc avformat/movenc: remove experimental check for VP9 streams
The muxer has been updated and is now complaint with the v1.0 of the spec.
2017-05-17 20:52:50 -03:00
Rostislav Pehlivanov
3fefaeaa0b img2dec: use standard way to probe for svg/svgz files 2017-05-16 12:45:14 +01:00
Rostislav Pehlivanov
f68ea92833 img2dec: add support for piped SVG demuxing
Only checks the extension and MIME type, since determining whether
a file is SVG is difficult since they're just XML files.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-05-16 11:27:00 +01:00
Hendrik Leppkes
64ad44a381 movenc/isom: update vpcC box to version 1.0 of the specification
This brings our generation of the vpcC box up to date to version 1.0
of the VP Codec ISO Media File Format Binding.

Specifically, color/transfer properties are now written with values
based on ISO/IEC 23001-8, which is the same reference specification the
AVColor* enumerations are based on.
2017-05-16 01:53:05 +02:00
Steven Liu
7355c1dda2 avformat/hlsenc: move old_filename free operation earlier
Suggested-by: Aaron Levinson <alevinsn@aracnet.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-05-11 10:15:08 +08:00
李赞
3d23219637 avformat/wavdec: Check chunk_size
Fixes integer overflow and out of array access

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-10 15:21:17 +02:00
Simon Thelen
54b6bef6e1 libavformat/tcp: fix return code for tcp_accept
ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
undefined), return ret instead and return ff_neterror() in
ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
Windows.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-10 14:00:20 +02:00
Steven Liu
cc25a887c5 avformat/matroskadec: fix resource leak
Fixes Coverity CID: 1405453

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-05-07 11:29:08 +08:00
Ricardo Constantino
c0b3781bf2 rtmpproto: send swfverify value as swfurl if latter is unused
Replicates lavf/librtmp.c behavior in L149-156 and rtmpdump's
behavior with "--swfVfy <url>" passing the url to swfUrl.

Fixes trac ticket #5549.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-07 00:57:08 +02:00
Aaron Levinson
b9d2005ea5 avformat/utils: free AVStream.codec properly in free_stream()
Fixes memory leaks.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-06 17:23:28 -03:00