Commit Graph

67115 Commits

Author SHA1 Message Date
Chris Watkins
3fb241210a 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-08-20 14:38:27 +02:00
Andreas Cadhalpun
9463930faf wmalosslessdec: reset frame->nb_samples on packet loss
Otherwise a frame with non-zero nb_samples but without any data can be
returned.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:27 +02:00
Andreas Cadhalpun
9e52f6b986 wmalosslessdec: avoid reading 0 bits with get_bits
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit f9020d514e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:27 +02:00
Michael Niedermayer
7ecaa736e7 avcodec/rawenc: Use ff_alloc_packet() instead of ff_alloc_packet2()
the later is not optimal when the buffer size is well known at allocation time

This avoids a memcpy()
Overall 2.5% speedup with a random 1920x1080 video

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
7fdc2ba3d4 avcodec/aacsbr: Assert that bs_num_env is positive
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2e13a45b1a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
514d0e29c8 avcodec/aacsbr: check that the element type matches before applying SBR
Fixes out of array access
Fixes: signal_sigsegv_3670fc0_2818_cov_2307326154_moon.mux

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 79a98294da)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
47a5cde6ac avcodec/h264_slice: Use w/h from the AVFrame instead of mb_w/h
Fixes out of array access
Fixes: asan_heap-oob_4d5bb0_682_cov_3124593265_Fraunhofer__a_driving_force_in_innovation__small.mp4

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 330863c9f1)

Conflicts:

	libavcodec/h264_slice.c
2015-08-20 14:38:26 +02:00
James Zern
c6e16ec711 vp9/update_prob: prevent out of bounds table read
the max value of the lookup in expanded form is:
(((1 << 7) - 1) << 1) - 65 + 1 + 64 = 254

add one entry of padding to inv_map_table[] to prevent out of bounds
access with non-conforming / fuzzed bitstreams

Signed-off-by: James Zern <jzern@google.com>
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e91f860ea7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
3dfadef522 avfilter/vf_transpose: Fix rounding error
Fixes out of array access
Fixes: asan_heap-oob_7f875d_3482_cov_1818465256_ssudec.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0083c16605)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
e35c534890 avcodec/pngdec: Only allow one IHDR chunk
Multiple IHDR chunks are forbidden in PNG
Fixes inconsistency and out of array accesses

Fixes: asan_heap-oob_4d5c5a_1738_cov_2638287726_c-m2-8f2b481b7fd9bd745e620b7c01a18df2.png

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 47f4e2d896)

Conflicts:

	libavcodec/pngdec.c
2015-08-20 14:38:26 +02:00
Andreas Cadhalpun
2789d15114 wmavoice: limit wmavoice_decode_packet return value to packet size
Claiming to have decoded more bytes than the packet size is wrong.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
a47bc9a056 swscale/swscale_unscaled: Fix rounding difference with RGBA output between little and big endian
Fixes fate/dds-rgb16 on big endian

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

Conflicts:

	tests/ref/fate/dds-rgb16
2015-08-20 14:38:26 +02:00
Michael Niedermayer
925adad3e0 ffmpeg: Do not use the data/size of a bitstream filter after failure
Found-by: Rodger Combs
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8f0f678f09)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
James Almer
286e14667f swscale/x86/rgb2rgb_template: fix signedness of v in shuffle_bytes_2103_{mmx,mmxext}
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit e22edbfd41)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
James Almer
1795bef7c7 swscale/x86/rgb2rgb_template: add missing xmm clobbers
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 910eeab480)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Sebastien Zwickert
d50d11c56c vda: unlock the pixel buffer base address.
The pixel buffer base address is never unlocked this causes
a bug with some pixel format types that are produced natively
by the hardware decoder: the first buffer was always used.
Unlock the pixel buffer base address fixes the issue.
(cherry picked from commit c06fdacc3d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
bada03d746 swscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7604358018)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
2f1bff1690 swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix shuffle_bytes_2103_c on BE
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit abb833c568)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
60a3bd625f swscale/rgb2rgb_template: Disable shuffle_bytes_2103_c on big endian
The function is specific to little endian

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Michael Niedermayer
0077298904 swr: Remember previously set int_sample_format from user
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d4325b2fea)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:26 +02:00
Andreas Cadhalpun
b3745ce8c2 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-08-20 14:38:26 +02:00
Andreas Cadhalpun
933ae708c5 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-08-20 14:38:25 +02:00
Michael Niedermayer
e588252a42 avcodec/dpxenc: implement write16/32 as functions
Fixes undefined behavior and segfault

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:25 +02:00
Andreas Cadhalpun
7de7d81ee5 postproc: fix unaligned access
QP_store is only 8-bit-aligned, so accessing it as uint32_t causes
SIGBUS crashes on sparc.
The AV_RN32/AV_WN32 macros only do unaligned access in the
HAVE_FAST_UNALIGNED case.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:38:25 +02:00
wm4
9d0aa058c9 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-08-20 14:38:25 +02:00
Andreas Cadhalpun
5302adb323 h264: er: Copy from the previous reference only if compatible
Also use the frame pixel format instead of the one from the codec
context, which is more robust.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit fdc64a1044)

Conflicts:

	libavcodec/h264_slice.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:12 +02:00
Andreas Cadhalpun
c5dd6fefd4 sonic: set avctx->channels in sonic_decode_init
Otherwise it can be 0 in sonic_decode_frame, causing SIGFPE crashes.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:12 +02:00
Andreas Cadhalpun
13a9a0c1a4 vp8: change mv_{min,max}.{x,y} type to int
If one of the dimensions is larger than 8176, s->mb_width or
s->mb_height is larger than 511, leading to an int16_t overflow of
s->mv_max.{x,y}. This then causes av_clip to be called with amin > amax.

Changing the type to int avoids the overflow and has no negative
effect, because s->mv_max is only used in clamp_mv for clipping.
Since mv_max.{x,y} is positive and mv_min.{x,y} negative, av_clip can't
increase the absolute value. The input to av_clip is an int16_t, and
thus the output fits into int16_t as well.

For additional safety, s->mv_{min,max}.{x,y} are clipped to int16_t range
before use.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 6fdbaa2b7f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:12 +02:00
Andreas Cadhalpun
9da5ba1f57 vp9: change type of tile_size from unsigned to int64_t
Otherwise the check 'tile_size < size' treats a negative size as
unsigned, causing the check to pass. This subsequently leads to
segmentation faults.

This was originally fixed as part of Libav commit 72ca83, so the
original author is one of the following developers:
        Anton Khirnov <anton@khirnov.net>
        Diego Biurrun <diego@biurrun.de>
        Luca Barbato <lu_zero@gentoo.org>
        Martin Storsjö <martin@martin.st>

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit b18eac7ff2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:12 +02:00
Andreas Cadhalpun
8c8406462b arm: only enable setend on ARMv6
Without this check it causes SIGILL crashes on ARMv5.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:12 +02:00
Andreas Cadhalpun
18aef7c075 libopenjpegdec: check existence of image component data
libopenjpeg can return images with components without data.

This fixes segmentation faults.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:12 +02:00
Andreas Cadhalpun
cd83ff5d4c 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-08-20 14:29:12 +02:00
Michael Niedermayer
22349b9f7d ffmpeg_opt: Check for localtime() failure
Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8e91d9652e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:12 +02:00
Deliang Fu
d54ca4167c 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-08-20 14:29:12 +02:00
Andreas Cadhalpun
670832e2a2 takdec: ensure chan2 is a valid channel index
If chan2 is not smaller than the number of channels, it can cause
segmentation faults due to dereferencing a NULL pointer.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 05c57ba2f4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
6ff5c4cd49 avcodec/h264_slice: Use AVFrame diemensions for grayscale handling
The AVFrame values are closer to the AVFrame bitmap changed instead of
the AVCodecContext values, so this should be more robust

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

Conflicts:

	libavcodec/h264_slice.c
2015-08-20 14:29:11 +02:00
Michael Niedermayer
402f832984 avdevice/lavfi: do not rescale AV_NOPTS_VALUE in lavfi_read_packet()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 913685f552)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Simon Thelen
d768242152 libavutil/channel_layout: Correctly return layout when channel specification ends with a trailing 'c'.
Return layout when FF_API_GET_CHANNEL_LAYOUT_COMPAT is set even if the
layout itself is not in the deprecated style.

Signed-off-by: Simon Thelen <ffmpeg-dev@c-14.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 83307a32eb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
84cf741861 avcodec/jpeg2000dec: Check that coords match before applying ICT
This avoid potential out of array accesses

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
8fc8b3eebe 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-08-20 14:29:11 +02:00
Michael Niedermayer
5709ac5c42 avcodec/adpcm: Check for overreads
See: vlc ticket 14649
Reported-by: carl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3c803ed9cb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
4121c1db15 avcodec/alsdec: Check for overread
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c265763318)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
0081afeaa7 avcodec/atrac3plusdec: consume only as many bytes as available
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6b6ae7c3ea)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
df2258f18d swresample/swresample: Cleanup on init failure.
This avoids leaks if the user doest call swr_close() after a failed init

Found-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c3f87f7545)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
8498cf60b2 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-08-20 14:29:11 +02:00
Michael Niedermayer
3943086656 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-08-20 14:29:11 +02:00
Ganesh Ajjanagadde
35ab85884b swresample/dither: check memory allocation
check memory allocation in swri_get_dither()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-08-20 14:29:11 +02:00
Michael Niedermayer
f141ac2d70 Merge commit 'c49b88b93bca53c04f18d78c27dbf1dc6daea909' into release/2.4
* commit 'c49b88b93bca53c04f18d78c27dbf1dc6daea909':
  opusdec: properly handle mismatching configurations in multichannel streams

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-20 14:20:26 +02:00
Michael Niedermayer
e0f859e8fe Merge commit '859ce02c9815b492da627d3098548b4f69bbc80e' into release/2.4
* commit '859ce02c9815b492da627d3098548b4f69bbc80e':
  h263: Always check both dimensions

Conflicts:
	libavcodec/ituh263dec.c

See: 62006b539d
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-20 14:14:53 +02:00
Michael Niedermayer
7da1e8a0d8 Merge commit 'aa3ec219e1a5cc0e96ddec6ea83312ec780448f5' into release/2.4
* commit 'aa3ec219e1a5cc0e96ddec6ea83312ec780448f5':
  imc: add required padding for GetBitContext buffer

Conflicts:
	libavcodec/imc.c

See: 7444cf9a9c
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-20 14:11:30 +02:00