Commit Graph

23554 Commits

Author SHA1 Message Date
James Almer
e7f1540507 avformat/mpegtsenc: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:49 -03:00
James Almer
42422b6dca avformat/mpegts: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:49 -03:00
James Almer
ecdad29b67 avformat/movenc: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:49 -03:00
James Almer
2e80435a9a avformat/matroskaenc: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:49 -03:00
James Almer
8d78e90a6b avformat/matroskadec: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:49 -03:00
James Almer
f57a258223 avformat/hls: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:49 -03:00
James Almer
83a320226c avformat/flacdec: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:49 -03:00
James Almer
453021c74e avformat/id3v2: replace call to av_init_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
4de3504adf avformat/flac_picture: replace call to av_init_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
9e92fd97d0 avformat/avienc: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
a7c238cbd8 avformat/avidec: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
3c69e5cd6f avformat/asfdec_o: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
82faeb56ce avformat/amvenc: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
01f4d33b41 avformat/utils: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
9066969713 avformat/mux: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:06:48 -03:00
James Almer
d422b2ed87 avcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct
The next pointer is kept at the end for backwards compatability until the
major bump, when it should ideally be moved at the front.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 14:12:17 -03:00
James Almer
f7db77bd87 avcodec/packet: deprecate av_init_packet()
Once removed, sizeof(AVPacket) will stop being a part of the public ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 14:12:17 -03:00
Derek Buitenhuis
8f1580c31a avformat/mov: Handle when we have an mfra box but have not read the full sidx for a fragment
Use the tfra timestamp if it is available and sidx timestamp is not.

Fixes reading the entire file after seeking in a live-style DASH FMP4
with an MFRA.

This specifically fixes when use_mfra_for is set.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-03-17 14:46:48 +00:00
Andriy Gelman
9383885c0d avformat/aviobuf: don't reduce short seek threshold
Commit 8c8e5d5286 added a way to reduce
seek time by waiting for the windowed tcp packets instead of creating a
new socket connection. It implemented this by overwriting
s->short_seek_threshold in avio_seek(). However,
s->short_seek_threshold could already be set and be higher than the
threshold set by the protocol (i.e. s->short_seek_threshold is set in
ff_configure_buffers_for_index()).

This new feature was only enabled for tls connections in
70d8077b79. As in Ticket #9148 it reduced
performance because instead of waiting to refill the AVIOContext buffers
with an existing connections, a new HTTP request was often made instead.

Fixes Ticket #9148.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-03-16 22:46:25 -04:00
Michael Niedermayer
5282147d0c avformat/matroskadec: Check for EOF in resync loop
Fixes: Timeout (too long -> instantly)
Fixes: 29136/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4586141227548672

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-15 22:24:31 +01:00
Michael Niedermayer
712d3ac539 avformat/ipmovie: Free packets allocated in header reading
Fixes: memleaks
Fixes: 29905/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5679700745781248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-15 22:24:31 +01:00
Ed Martin
63344337f9 libavformat/hls: Reset options after open_url_keepalive() fails
open_url_keepalive() unsets the options when it uses them, this
includes the offsets for the Range: header. When using the HLS
tag #EXT-X-BYTERANGE along with multiple files, the range options
must be preserved after open_url_keepalive() returns EOF so that
the new file can be opened. Failure to do this results in ignoring
the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file.

To fix it, reset the options before calling io_open() following
open_url_keepalive() reaching EOF

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
2021-03-15 15:16:20 +08:00
Michael Niedermayer
337984c133 avformat/voc_packet: prevent remaining size from becoming negative in ff_voc_get_packet()
Fixes: memleak
Fixes: 30909/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4886284057313280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-14 23:29:51 +01:00
Michael Niedermayer
403b35e16e avformat/mvi: Check audio size for more overflows
Fixes: left shift of negative value -352256000
Fixes: 30837/clusterfuzz-testcase-minimized-ffmpeg_dem_MVI_fuzzer-5755626262888448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-14 23:29:51 +01:00
Michael Niedermayer
1c88098651 avformat/samidec: Deallocate hdr_buf
Fixes: memleak
Fixes: 30841/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4521799196999680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-14 23:29:51 +01:00
Michael Niedermayer
09b3040354 avformat/cinedec: Fix index_entries size check
Fixes: out of array access
Fixes: 29868/clusterfuzz-testcase-minimized-ffmpeg_dem_CINE_fuzzer-5692001957445632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-13 21:02:31 +01:00
Michael Niedermayer
4e7dbca74c avformat/aaxdec: Check that segments table has been initialized
Fixes: Timeout
Fixes: 29766/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-5635887566290944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-13 21:02:31 +01:00
Marton Balint
c281d84b20 avformat: add Changelog entry for librist and bump minor
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-13 17:36:48 +01:00
Marton Balint
5bd1d0f4e7 avformat/librist: clarify and limit buffer_size
As suggested by librist developers.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-13 17:36:48 +01:00
Marton Balint
4217e091fe avformat/librist: increase default loglevel
Also remove AV_LOG_SIMULATE from the list as it is not used directly, and do
not use panic level on unknown loglevel, but make them warn. Also fix mapping of
NOTICE/INFO/VERBOSE and add documentation about when the option should actually
be used.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-13 17:36:48 +01:00
Marton Balint
7b0832dea8 avformat/librist: simplify secret strlcpy
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-13 17:36:48 +01:00
Marton Balint
deffb5ddce avformat/librist: make packet size adjustable for writing, fix it for reading
Maximum packet size is 10000 (RIST_MAX_PACKET_SIZE, which is unfortunately
private) minus the RIST protocol overhead which is 28 bytes for the unencrypted
case, 36 for the encrypted case.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-13 17:36:48 +01:00
Marton Balint
4b1e387e25 avformat/librist: rework librist_read
Queue tracking makes no difference so remove it, return EAGAIN of no data is
available and rist data block needs to be freed even for zero sized packets.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-13 17:36:48 +01:00
Paul B Mahol
4098f809d6 libavformat: add librist protocol
This work is sponsored by Open Broadcast Systems.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2021-03-13 17:36:48 +01:00
Andreas Rheinhardt
d025a5bcc2 avformat/adp, svs: Remove redundant av_shrink_packet()
av_get_packet() already makes sure that the packet size is accurate
and that the packet data is zero-padded even when one could not read as
much as desired.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-12 17:13:10 +01:00
parazyd
51367267c8 avformat/gopher: Add support for Gopher over TLS
This commit adds a "gophers" handler to the gopher protocol. gophers
is a community-adopted protocol that acts the same way like normal
gopher with the added TLS encapsulation.

The gophers protocol is supported by gopher servers like geomydae(8),
and clients like curl(1), clic(1), and hurl(1).

This commit also adds compilation guards to both gopher and gophers,
since now there are two protocols in the file it makes sense to
have this addition.

Signed-off-by: parazyd <parazyd@dyne.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-11 23:47:19 +01:00
parazyd
ed4c2e183b avformat/gopher: Add default_whitelist to ff_gopher_protocol
Signed-off-by: parazyd <parazyd@dyne.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-11 23:26:37 +01:00
Stephen Hutchinson
16e8ea0dde avisynth: fix audio on big endian
AviSynth+ outputs audio in the same format as the
OS, so assuming little endian formats as input
on big endian OSes results in nothing but static.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2021-03-11 14:21:30 -05:00
emcodem
8b74458d93 avisynth: populate field order
Fixes Trac ticket #8757

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2021-03-11 14:21:30 -05:00
Stephen Hutchinson
4c40686ee2 avisynth: more intelligent RGB flipping
avs_is_color_space provides a generic way of checking whether the
video is RGB, and has been available through AVSC_API since 2.6.
This means that GetProcAddress doesn't have to run on every frame.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2021-03-11 14:21:30 -05:00
Andreas Rheinhardt
9f1b808bde avformat/rawenc: Use init instead of write_header function
force_one_stream() does not write anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-11 20:01:28 +01:00
James Almer
e07126f54a avformat: use the buffer_size_t typedef where required
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-10 20:26:36 -03:00
James Almer
42e68fe015 avformat/utils: change AVStream side data related public function and struct size types to size_t
av_stream_add_side_data() already defines size as a size_t, so this makes it
consistent across all side data functions.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-10 20:26:36 -03:00
Michael Niedermayer
c35e456f54 avformat/mvdec: Allocate extradata only once
Fixes: memleak
Fixes: 28686/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5822961932173312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-09 21:16:56 +01:00
Michael Niedermayer
09e5e406c7 avformat/flvdec: Check double before cast in parse_keyframes_index()
Fixes: -2.21166e+304 is outside the range of representable values of type 'long'
Fixes: 29169/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5725452796821504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Michael Niedermayer
bcb1e9d3b9 avformat/paf: Check for EOF before allocation in read_header()
Fixes: OOM
Fixes: 26584/clusterfuzz-testcase-minimized-ffmpeg_dem_PAF_fuzzer-5172661183053824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Michael Niedermayer
1957095e80 avformat/swfdec: Check outlen before allocation
Fixes: Timeout (too long -> 241ms)
Fixes: 29083/clusterfuzz-testcase-minimized-ffmpeg_dem_SWF_fuzzer-6273684478230528

The source of the magic number is
A very quick simulation of the best case compression for "compress"
below is not nice written code as i did not expect I or anyone else
would ever see it again

I would have preferred some nicer expression or course, but thats
what it seems to be asymptotically. For smaller amounts of data a
tighter bound is possible but i saw no nice way to consider that
and it seems also overkill to try to do it more fine grained for
just this

main(){
    int64_t bits = 0;
    int bank = 256;
    int bitbank = 8;
    for(unsigned i = 0; i<1024*1024*1024*4U-100000;) {
        int word_size = bank-255;
        i += word_size;
        bits += bitbank;

        if (!(bank & (bank-1)))
            bitbank ++;
        bank++;
        if (bitbank > 16) {
            printf("BEST %f \n", 8.0 * i / bits );
            bank = 256;
            bitbank = 8;
        }
    }
}

above assumes i remembered correctly how the algorithm works but the
value was close to what actual compession of zeros gave

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Florian Nouwt
f067fcb9df mobiclip: fix copyright headers
The Mobiclip related code was based on Mobius (https://github.com/adibsurani/Mobius),
which was based on my original reverse engineering efforts (https://github.com/Gericom/MobiclipDecoder).
This commit adds the appropriate copyright headers on the related files.

Signed-off-by: Florian Nouwt <fnouwt2@gmail.com>
2021-03-08 19:19:19 +01:00
Andreas Rheinhardt
ea3953ad40 avformat/dashdec: Don't needlessly strdup metadata
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 02:25:52 +01:00
Andreas Rheinhardt
9a38e6ff97 avformat/dashdec: Remove limit on length of id
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 02:25:32 +01:00