1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00
Commit Graph

17163 Commits

Author SHA1 Message Date
Michael Niedermayer
93e168705d avformat/dump: Fix integer overflow in av_dump_format()
Fixes part of mozilla bug 1229167

Found-by: Tyson Smith
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8e7f452022)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-20 10:59:27 +01:00
Andreas Cadhalpun
f7b4e46251 ffm: reject invalid codec_id and codec_type
A negative codec_id cannot be handled by the found_decoder API of
AVStream->info: if the codec_id is not recognized, found_decoder is set
to -codec_id, which has to be '<0' according to the API documentation.

This can cause NULL pointer dereferencing in try_decode_frame.

Also make sure the codec_type matches the expected one for codec_id.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit ecf63b7cc2)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-17 21:37:23 +01:00
Andreas Cadhalpun
e1b38b3685 ffmdec: reject zero-sized chunks
If size is zero, avio_get_str fails, leaving the buffer uninitialized.
This causes invalid reads in av_set_options_string.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit a611375db5)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-17 21:37:10 +01:00
Andreas Cadhalpun
48e86b6961 mxfdec: check edit_rate also for physical_track
Previously only the edit_rate of material_track was checked.
If it's negative, it causes assertion failures in av_rescale_rnd.

Reviewed-by: Tim Nicholson <nichot20-at-yahoo.com@ffmpeg.org>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 047bf82c18)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-26 01:37:33 +01:00
Andreas Cadhalpun
de61d9f8a1 riffdec: prevent negative bit rate
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 189420cb56)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-26 01:37:33 +01:00
Michael Niedermayer
9b93805245 Merge commit 'd80811c94e068085aab797f9ba35790529126f85'
* commit 'd80811c94e068085aab797f9ba35790529126f85':
  riff: Use the correct logging context

Conflicts:
	libavformat/asfdec_o.c
	libavformat/avidec.c
	libavformat/dxa.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/riff.h
	libavformat/riffdec.c
	libavformat/wavdec.c
	libavformat/wtvdec.c
	libavformat/xwma.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ba77fb61f7)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-26 01:37:33 +01:00
Martin Storsjö
949f5dbcfb rtmpcrypt: Do the xtea decryption in little endian mode
The XTEA algorithm operates on 32 bit numbers, not on byte sequences.
The XTEA implementation in libavutil is written assuming big endian
numbers, while the rtmpe signature encryption assumes little endian.

This fixes rtmpe communication with rtmpe servers that use signature
type 8 (XTEA), e.g. crunchyroll.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e7728319b92dbb4fb949155e33de7ff5358ddff3)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:40 +01:00
Michael Niedermayer
89612acc81 avformat/matroskadec: Check subtitle stream before dereferencing
Unrecognized streams are not allocated
Fixes: flicker-1.color1.vp91447030769.08.webm

Found-by: Chris Cunningham <chcunningham@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a5034b324c)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:39 +01:00
Michael Niedermayer
7c3fc6bf06 avformat/utils: Do not init parser if probing is unfinished
Fixes assertion failure
Fixes: 136f8b8d47af7892306625e597dee655/signal_sigabrt_7ffff6ae7cc9_8941_ab11bea57c84796418f481f873dc31ba.dvr_ms

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1ef336e912)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:39 +01:00
Andreas Cadhalpun
bbeae2c690 jvdec: avoid unsigned overflow in comparison
The return type of strlen is size_t, i.e. unsigned, so if pd->buf_size
is 3, the right side overflows leading to a wrong result of the
comparison and subsequently a heap buffer overflow.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit db374790c7)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:39 +01:00
Michael Niedermayer
36b65f1c50 avformat/xmv: Discard remainder of packet on error
Fixes infinite loop
Fixes: 9c48ae2680c5f23bca3d20ff0f325fd8/asan_generic_4c254d_1374_993f1e5967dd6f844b8d72f978ce2a6c.pss

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 79c4a338e4)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:39 +01:00
Michael Niedermayer
0b3b993bae avformat/xmv: factor return check out of if/else
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9b6fac11da)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:39 +01:00
Andrey Utkin
289e74d72d avformat/httpauth: Add space after commas in HTTP/RTSP auth header
This fixes access to Grandstream cameras, which return 401 to ffmpeg
otherwise.
VLC sends Authorization: header with spaces between parameters, and it
is known to work with Grandstream devices and broad range of other HTTP
and RTSP servers, so author considers switching to such behaviour safe.
Just for record - RFC 2617 (HTTP Auth) does not specify the need in
spaces, so this is not a bug of FFmpeg.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fdb3283872)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:38 +01:00
Simon Thelen
b096f16095 lavf/webvttenc: Require webvtt file to contain exactly one WebVTT stream.
Not requiring this can end up producing hilariously broken files
together with -c:s copy (e.g. a webvtt file containing binary subtitle data).

Signed-off-by: Simon Thelen <ffmpeg-dev@c-14.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b84232694e)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:38 +01:00
Michael Niedermayer
fb84d92079 avformat/mov: Fix integer overflow in FFABS
Fixes: unknown_unknown_19e_414_cov_764838672_bellhamlam.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 053e80f6ea)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:38 +01:00
Michael Niedermayer
c23902b671 avformat/dump: Fix integer overflow in aspect ratio calculation
Fixes: unknown_unknown_19e_414_cov_764838672_bellhamlam.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d1bdaf3fb2)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:38 +01:00
Michael Niedermayer
10870af7e4 avformat/hevc: Check num_long_term_ref_pics_sps to avoid potentially long loops
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ee155c18a2)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:37 +01:00
Arthur Grant
d405a10743 avformat/hevc: Fix parsing errors
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 781efd0741)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:37 +01:00
Michael Niedermayer
dea4fd9446 avformat/mux: Update sidedata in ff_write_chained()
Fixes Ticket4777

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit db91e0edb6)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:37 +01:00
wm4
da7d36ef80 rawdec: fix mjpeg probing buffer size check
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4c6beaed92)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:37 +01:00
wm4
29fde41906 rawdec: fix mjpeg probing
There can be other headers than "Content-Type:" (in this case, a
"Content-Length:" header was following), so checking for a trailing
newline is wrong.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bf51fcd304)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 03:51:37 +01:00
Rodger Combs
e43e282512 lavf/matroskadec: Fully parse and repack MP3 packets
Fixes https://trac.ffmpeg.org/ticket/4776

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b4b2717ffe)
2015-10-09 21:48:25 +02:00
Michael Niedermayer
bd4351b5d7 avformat/oggenc: Check segments_count for headers too
Fixes infinite loop and segfault in ogg_buffer_data()
Fixes Ticket4806

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 81a8701eb5)
2015-10-09 21:47:52 +02:00
Michael Niedermayer
108a971cd2 avformat/avidec: Workaround broken initial frame
Fixes Ticket4851

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3e2ef00394)
2015-10-09 21:47:07 +02:00
Przemysław Sobala
b0b37e018b lavf/img2dec: Fix memory leak
Fixes #4886

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 01dd7e025c)
2015-10-09 21:44:11 +02:00
Clément Bœsch
d75a5fe4b9 avformat/srtdec: make sure we probe a number
Fixes regression since 7218352e02: WebVTT
files were matching the SRT probing.
(cherry picked from commit 40d9d6de90)
2015-10-09 21:43:37 +02:00
Clément Bœsch
6ed351c096 avformat/srtdec: more lenient first line probing
Fixes Ticket #4898
(cherry picked from commit 7218352e02)
2015-10-09 21:43:26 +02:00
Andreas Cadhalpun
a3d3e0a6bc nutdec: check maxpos in read_sm_data before returning success
Otherwise sm_size can be larger than size, which results in a negative
packet size.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 6b9fdf7f4f)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit eddf146ada)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-23 01:35:09 +02:00
Michael Niedermayer
e604662d04 avformat/mov: Fix deallocation when MOVStreamContext failed to allocate
Fixes: 260813283176b57b3c9974fe284eebc3_signal_sigsegv_7ffff713351a_991_xtrem_e2_m64q15_a32sxx.3gp with memlimit of 262144

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 15629129dd)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-20 04:43:41 +02:00
Chris Watkins
77f5302465 oggparsedirac: check return value of init_get_bits
If init_get_bits fails the GetBitContext is invalid and must not be
used. Check the return value in dirac_header and propogate the error.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4f5c2e651a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:41 +02:00
Andreas Cadhalpun
5019f8d10c matroskadec: check audio sample rate
And default to 8000 if it is invalid.

An invalid sample rate can trigger av_assert2 in av_rescale_rnd.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 5b76c82fd7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:40 +02:00
Andreas Cadhalpun
476cf3eb7e matroskadec: validate audio channels and bitdepth
In the TTA extradata re-construction the values are written with
avio_wl16 and if they don't fit into uint16_t, this triggers an
av_assert2 in avio_w8.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 92e79a2f7b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:40 +02:00
wm4
c049e979b6 avio: fix potential crashes when combining ffio_ensure_seekback + crc
Calling ffio_ensure_seekback() if ffio_init_checksum() has been called
on the same context can lead to out of bounds memory accesses and
crashes. The reason is that ffio_ensure_seekback() does not update
checksum_ptr after reallocating the buffer, resulting in a dangling
pointer.

This effectively fixes potential crashes when opening mp3 files.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dc87758775)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:40 +02:00
Andreas Cadhalpun
274121179f mov: abort on EOF in ff_mov_read_chan
Otherwise the loop can take a lot of time if num_descr is very large.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit a5718863da)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:40 +02:00
Deliang Fu
35e46e74bc avformat: Fix bug in parse_rps for HEVC.
Make the logic in libavformat/hevc.c parse_rps align with libavcodec/hevc_ps.c ff_hevc_decode_short_term_rps

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e1f8780c8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:40 +02:00
Michael Niedermayer
e21db6e339 avformat/ffmdec: Check ffio_set_buf_size() return value
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dc55477a64)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Michael Niedermayer
7050d07562 Revert "avformat/rtpenc: check av_packet_get_side_data() return, fix null ptr dereference"
This was simply wrong

Found-by: Martin Storsjö
This reverts commit 5d8e4f6da0.
(cherry picked from commit 3e34b7498f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Michael Niedermayer
19cef664fe avformat/mxfenc: Accept MXF D-10 with 49.999840 Mbit/sec
This is the maximum rate possible based on the frame size limit of MXF D-10

Previous version reviewed by tim nicholson <nichot20@yahoo.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d7a762553c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Rodger Combs
308bcf53f9 avformat/wavdec: Increase dts packet threshold to fix more misdetections
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 40a3e1e9c5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Michael Niedermayer
4db46cf520 avformat/wavdec: Increase probe_packets limit
Fixes DTS detection of b2429e5ba9.dts

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9f5769437a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Andreas Cadhalpun
cb921dd47f nutdec: abort if EOF is reached in decode_info_header/read_sm_data
These loops can take a lot of time if count is very large.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit bb23a15df5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Andreas Cadhalpun
9c3d306ba4 nutdec: stop skipping bytes at EOF
This can unnecessarily waste a lot of time.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit fa7dec8cb0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Andreas Cadhalpun
d4d8c3553d nutdec: fix infinite resync loops
nut->last_syncpoint_pos doesn't necessarily change between resync
attempts, so find_any_startcode can return the same startcode again.

Thus remember where the last resync happened and don't try to resync
before that.

This can't be done locally in nut_read_packet, because this wouldn't
prevent infinite resync loops, where after the resync a packet is
returned and while reading a following packet the resync happens again.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 37e679881d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Michael Niedermayer
bd9313d9f8 avformat/nutdec: Check X in 2nd branch of index reading
Prevents read of uninitialized variable

Based on patch by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ebb0ca3d70)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:39 +02:00
Michael Niedermayer
6270401561 avformat/nutdec: Fix recovery when immedeately after seeking a failure happens
Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b3496b4a33)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:38 +02:00
Michael Niedermayer
862ba8b4b4 avformat/nutdec: Return error on EOF from get_str()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6bbb2f8f4d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:38 +02:00
Martin Storsjö
94a3d2e49c rtsp: Make sure we don't write too many transport entries into a fixed-size array
(cherry picked from commit b90adb0aba)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:38 +02:00
Andrey Utkin
4c2a1e673b rtpenc_jpeg: handle case of picture dimensions not dividing by 8
This fixes the calculation of the number of needed blocks to make
sure that ALL pixels are represented by the result.

Reviewed-by: Thomas Volkert <silvo@gmx.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7f64a7503b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-20 04:43:38 +02:00
Michael Niedermayer
a5e18e900f avformat/swfdec: Do not error out on pixel format changes
Instead print an error and continue

Fixes Ticket4702

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6a1204a1a4)
2015-07-08 12:42:36 +02:00
Michael Niedermayer
8c5d196f50 avformat/mov: Mark avio context of decompressed atoms as seekable
Fixes Ticket4329

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8ce564ea28)
2015-06-19 10:57:07 +02:00