14773 Commits

Author SHA1 Message Date
Michael Niedermayer
4f0d1af68a avformat/matroskadec: Use tracks[k]->stream instead of s->streams[k]
The later is not correct

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:09 +02:00
Andreas Cadhalpun
7d9725187d matroskadec: check s->streams[k] before using it
This fixes a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:09 +02:00
Andreas Cadhalpun
1f5eeed43b matroskadec: use uint64_t instead of int for index_scale
index_scale is set to matroska->time_scale of type uint64_t.

When index_scale is int, the assignment can overflow and e.g. result
in index_scale = 0. This causes a floating point exception due to the
division by index_scale.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:09 +02:00
Andreas Cadhalpun
ffdd93fe79 nutdec: fix illegal count check in decode_main_header
The existing check has two problems:
 1) i + count can overflow, so that the check '< 256' returns true.
 2) In the (i == 'N') case occurs a j-- so that the loop runs once more.

This can trigger the assertion 'nut->header_len[0] == 0' or cause
segmentation faults or infinite hangs.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:09 +02:00
Andreas Cadhalpun
b548a6208e nutdec: check for negative frame rate in decode_info_header
A negative frame rate triggers an av_assert2 in av_rescale_rnd.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:09 +02:00
Vittorio Giovara
cd5a832b0a lavf: Reset global flag on deinit
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 32da94fa7f73ac749e0a1e2f20499fad2f6f57fe)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:09 +02:00
Andreas Cadhalpun
940b9484dc bink: check vst->index_entries before using it
This fixes a NULL pointer dereference if vst->duration is 0.

The problem was introduced in commit 0588acaf.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:09 +02:00
Michael Niedermayer
f494b906e3 avformat/utils: Ensure that AVFMT_FLAG_CUSTOM_IO is set before use
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba631b791435c395361e2026fc7419b341e57813)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:08 +02:00
Andreas Cadhalpun
dfd1d48730 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 bb23a15df507440deb0dcf25099d321d0f73dc28)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:08 +02:00
Andreas Cadhalpun
4d625f270a 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 fa7dec8cb00d2d0dd96ff9863ccda38428610a21)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:08 +02:00
Andreas Cadhalpun
9414358f15 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 37e679881d364b6da817d829d35869d657218ab3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:08 +02:00
Michael Niedermayer
fe1e6b919d 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 ebb0ca3d70465ab6d369a66b2ef43bb059705db8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:08 +02:00
Michael Niedermayer
8cfc0fdb23 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 b3496b4a33e806b7afdcbbf6f468b0332b676d7c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:08 +02:00
Michael Niedermayer
6ad3654670 avformat/nutdec: Return error on EOF from get_str()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6bbb2f8f4da67af374d62403742482cc5962aa21)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:08 +02:00
Michael Niedermayer
06fda5bef3 avformat/hevc: Check num_negative_pics and num_positive_pics
Fixes CID1238994

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:07 +02:00
Michael Niedermayer
55a9a37359 avformat/hevc: Check cpb_cnt_minus1
Fixes CID1239014

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:07 +02:00
Michael Niedermayer
ed578c91bf avformat/matroskadec: Cleanup error handling for bz2 & zlib
Fixes CID703652

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

Conflicts:

	libavformat/matroskadec.c
2015-06-17 21:50:06 +02:00
Michael Niedermayer
3062689f37 avformat/nutdec: Fix use of uinitialized value
Fixes CID1041175

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:06 +02:00
Michael Niedermayer
b8060bc217 avformat/rtpenc_jpeg: Check remaining buffer size for SOS
Fixes CID1238818

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:06 +02:00
Michael Niedermayer
0452e3e41c avformat/rtpdec_xiph: Check upper bound on len in xiph_handle_packet()
Larger packets are not supported and would cause problems later

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:06 +02:00
Michael Niedermayer
404db2b99e avformat/subtitles: Use size_t for len
string length could theoretically be larger than int

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a633928d47057426a9c328da594407d1c7da8a5c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:06 +02:00
Michael Niedermayer
17ad9778a9 avformat/url: Use size_t for len from strlen()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 95efc651294b3cf3e5ec4b3ed36e79d7261545ff)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:06 +02:00
Michael Niedermayer
d27b9d3bd1 avformat/vorbiscomment: Check entry length in ff_vorbiscomment_write()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit eca38864a6ce5053e463b8d3fc22b22bc9a49578)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 21:50:06 +02:00
wm4
539603e877 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 dc87758775e2ce8be84e4fe598e12416e83d2845)

Conflicts:

	libavformat/aviobuf.c
2015-06-17 21:50:06 +02:00
Andreas Cadhalpun
de8e63ca82 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 a5718863da99b54b6c853d45c84871c4a96a57c0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-16 16:21:03 +02:00
Deliang Fu
557aa4c6b3 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 6e1f8780c833ef55815111d4771b95ff78567cdb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-11 02:42:33 +02:00
Michael Niedermayer
78ef1be8e1 avformat/ffmdec: Check ffio_set_buf_size() return value
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dc55477a64cefebf8dcc611f026be71382814ae2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-07 15:24:03 +02:00
Michael Niedermayer
41e3d5bc3a 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 5d8e4f6da03c0342157e6ac7fab1a8ac3a87a8b0.
(cherry picked from commit 3e34b7498f14c04baadde1700a6f73a7e9e86fa6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-03 22:46:49 +02:00
Michael Niedermayer
f33adf1b53 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 d7a762553c6f6c422adb6632354bcc4ff577b701)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-03 12:25:55 +02:00
Michael Niedermayer
eaf674ef04 Merge commit 'c34d1099db6f9bc49f30eb3141f87c42b01a3714' into release/2.2
* commit 'c34d1099db6f9bc49f30eb3141f87c42b01a3714':
  nut: Make sure to clean up on read_header failure

Conflicts:
	libavformat/nutdec.c

See: 361702660d2c37a63b7d6381d39e1e1de8405260
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 13:12:29 +02:00
Andreas Cadhalpun
b216e8b02b nutdec: fix memleaks on error in nut_read_header
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 361702660d2c37a63b7d6381d39e1e1de8405260)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 13:12:10 +02:00
Michael Niedermayer
3bedd0d232 Merge commit '0654518597e6ee2947e4a81c26f03f9aec7ef656' into release/2.2
* commit '0654518597e6ee2947e4a81c26f03f9aec7ef656':
  avi: Validate sample_size

Conflicts:
	libavformat/avidec.c

See: ca234639ac49a0dc073ac1f10977979acdb94f97
See: c7369f3a4bd21ea64571c1b0c4fcbf39f8daf68c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 13:03:52 +02:00
Michael Niedermayer
7666ecbbcb avformat/avidec: print a warning for negative sample_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c7369f3a4bd21ea64571c1b0c4fcbf39f8daf68c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 13:03:39 +02:00
Andreas Cadhalpun
0658aef53a avidec: avoid infinite loop due to negative ast->sample_size
If max in clean_index is set to a negative ast->sample_size, the
following loop never ends:
        while (max < 1024)
            max += max;

Thus set ast->sample_size to 0 if it would otherwise be negative.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 13:03:36 +02:00
Michael Niedermayer
fb2f96d9ef Merge commit '3bebca9634f05ea5da7624e3a3f35ec95341e250' into release/2.2
* commit '3bebca9634f05ea5da7624e3a3f35ec95341e250':
  nut: Check chapter creation in decode_info_header

Conflicts:
	libavformat/nutdec.c

See: 3ff1af2b0db7132d5717be6395227a94c8abab07
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 13:00:48 +02:00
Andreas Cadhalpun
6dfb78d6f1 nutdec: check chapter creation in decode_info_header
This fixes a segmentation fault when accessing the metadata.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 13:00:39 +02:00
Michael Niedermayer
3db9966152 avformat/mux: Dont leave stale side data pointers in ff_interleave_add_packet()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bfb3ed1a9d5dafdc185080fdd88d02ff7221d30a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 12:48:38 +02:00
Michael Niedermayer
e348564030 Merge commit 'e3c4eb87e4d9650d76f6d8d790a9b749b325e973' into release/2.2
* commit 'e3c4eb87e4d9650d76f6d8d790a9b749b325e973':
  avpacket: Check for and return errors in ff_interleave_add_packet()

Conflicts:
	libavformat/audiointerleave.c
	libavformat/internal.h
	libavformat/mux.c

See: 4d7c71c36467331f1e0c0f17af9f371d33308a9c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 12:47:00 +02:00
Michael Niedermayer
c0d6afa3e6 avformat/mpegts: Also parse the FMC descriptor if the codec has not been identified yet
Fixes Detecting AAC with such descriptor if the parts needed for detection
are later in the stream

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

Conflicts:

	libavformat/mpegts.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 12:40:30 +02:00
Michael Niedermayer
0ca612a765 avformat/mpegts: reset last_version on seeking
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 639781492684fcad05da52e7700bcbf6086599ea)

Conflicts:

	libavformat/mpegts.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 12:38:14 +02:00
Michael Niedermayer
f30a57f5af Merge commit 'feedde4d8702d554a7f46de824a887fe4d75a714' into release/2.2
* commit 'feedde4d8702d554a7f46de824a887fe4d75a714':
  mpegts: Update the PSI/SI table only if the version change

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 12:34:54 +02:00
Michael Niedermayer
194bd16cfa Merge commit '4c4cc9b27b69a86e405fd7612aa0a62f3b62b027' into release/2.2
* commit '4c4cc9b27b69a86e405fd7612aa0a62f3b62b027':
  rtsp: Make sure we don't write too many transport entries into a fixed-size array

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 12:27:33 +02:00
Michael Niedermayer
ae6429e633 Merge commit '1f1686615c20982a68b2d8db3ff109834a260d27' into release/2.2
* commit '1f1686615c20982a68b2d8db3ff109834a260d27':
  rtpenc_jpeg: Handle case of picture dimensions not dividing by 8

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 12:27:07 +02:00
Luca Barbato
c34d1099db nut: Make sure to clean up on read_header failure
Based on Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> work.

CC: libav-stable@libav.org
(cherry picked from commit 1f64b018cbec018fa66a4a20f79958d9707913de)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2015-05-31 11:19:45 -04:00
Andreas Cadhalpun
0654518597 avi: Validate sample_size
And either error out or set it to 0 if it is negative.

CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit a55a70644872027fdf76a75edf12a09c9008880f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2015-05-31 11:19:22 -04:00
Andreas Cadhalpun
3bebca9634 nut: Check chapter creation in decode_info_header
This fixes a segmentation fault when accessing the metadata.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

CC: libav-stable@libav.org
(cherry picked from commit 21b21aed797b5e636adcf2df811f96a95f208930)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2015-05-31 11:19:11 -04:00
Michael Niedermayer
296d70f585 mux: Do not leave stale side data pointers in ff_interleave_add_packet()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
(cherry picked from commit 386e80610de282c92ad5897683ccaf2675766ac5)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2015-05-31 11:18:03 -04:00
Nidhi Makhijani
e3c4eb87e4 avpacket: Check for and return errors in ff_interleave_add_packet()
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit 324ff59444ff5470bb325ff1e2be7c4b054fc944)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2015-05-31 11:17:37 -04:00
John Högberg
feedde4d87 mpegts: Update the PSI/SI table only if the version change
If a PAT is finished while a PMT section filter is opened but
not yet finished, the PMT section filter is closed and all
the received data is discarded.

This is usually not an issue but some multiplexers (With very
quick PAT/PMT repetition settings) consistently emit a PMT
section start, then a PAT, and then the rest of the PMT,
causing the aforementioned behavior to result in no PMT being
finished.

In the most pathologic situation the stream information are lost
and the probe fallback miscategorizes subtitles as mp3 audio.

Avoid the issue through eliminating redundant PSI/SI table
updates by checking their version field, which is required by
the standard to be incremented on every change no matter how
minor.

CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 844201e35fe575710be8218d45828df49b77f205)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavformat/mpegts.c
2015-05-31 11:14:03 -04:00
Martin Storsjö
4c4cc9b27b rtsp: Make sure we don't write too many transport entries into a fixed-size array
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit f77c9d71615e17414aacbb1720693b800a5a32d3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2015-05-31 11:11:30 -04:00