ffmpeg.git
4 years agoupdate changelog n2.6.4
Michael Niedermayer [Thu, 23 Jul 2015 00:05:35 +0000 (02:05 +0200)]
update changelog

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoimc: use correct position for flcoeffs2 calculation
Andreas Cadhalpun [Fri, 10 Jul 2015 19:50:50 +0000 (21:50 +0200)]
imc: use correct position for flcoeffs2 calculation

flcoeffs2[pos] should be the log2 of flcoeffs1[pos].
flcoeffs1[0] can be 0 here, thus flcoeffs2[pos] gets set to -inf,
causing problems further down.

This seems to have been copied from imc_decode_level_coefficients in
commit 4eb4bb3 without updating the position.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agohevc: check slice address length
Andreas Cadhalpun [Fri, 10 Jul 2015 17:41:43 +0000 (19:41 +0200)]
hevc: check slice address length

It is used as get_bits argument and reading 0 bits isn't supported.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agosnow: remove an obsolete av_assert2
Andreas Cadhalpun [Thu, 9 Jul 2015 17:50:34 +0000 (19:50 +0200)]
snow: remove an obsolete av_assert2

It asserts that the frame linesize is larger than 37, but it can be
smaller and decoding such frames works.

Before commit cc884a35 src_stride > 7*MB_SIZE was necessary, because the
blocks were interleaved in the tmp buffer and the last block was added
with an offset of 6*MB_SIZE.
It was changed for src_stride <= 7*MB_SIZE to write the blocks
sequentially, hence the larger tmp_step.
After that the assert was only necessary to make sure that the buffer
remained large enough.
Since commit bd2b6b33 s->scratchbuf is used as tmp buffer.
As part of commit 86e107a7 the minimal scratchbuf size was increased to
256*7*MB_SIZE, which is enough for any src_stride <= 7*MB_SIZE.

Also add a comment explaining the tmp_step calculation.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 3526a120f92929cb0a4009e403ee2f141030c487)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 26cb351452e76dc4a61028f277cf11b8d7abd74b)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agowebp: fix infinite loop in webp_decode_frame
Andreas Cadhalpun [Thu, 2 Jul 2015 21:45:46 +0000 (23:45 +0200)]
webp: fix infinite loop in webp_decode_frame

The loop always needs at least 8 bytes for chunk_type and chunk_size.
If fewer are left, bytestream2_get_le32 just returns 0 without
reading any bytes, leading to an infinite loop.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agowavpack: limit extra_bits to 32 and use get_bits_long
Andreas Cadhalpun [Thu, 2 Jul 2015 21:05:05 +0000 (23:05 +0200)]
wavpack: limit extra_bits to 32 and use get_bits_long

More than 32 bits can't be stored in an integer and get_bits should not
be used with more than 25 bits.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoffmpeg: only count got_output/errors in decode_error_stat
Andreas Cadhalpun [Tue, 30 Jun 2015 19:09:50 +0000 (21:09 +0200)]
ffmpeg: only count got_output/errors in decode_error_stat

If threading is used, the first (thread_count - 1) packets are read
before any frame/error is returned. Counting this as successful decoding
is wrong, because it also happens when no single frame could be decoded.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoffmpeg: exit_on_error if decoding a packet failed
Andreas Cadhalpun [Tue, 30 Jun 2015 19:06:40 +0000 (21:06 +0200)]
ffmpeg: exit_on_error if decoding a packet failed

This is the second part of the fix for ticket #4370.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit cd64ead8d96b2d2c300e0ac620fb82b17d6051bf)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Conflicts:
ffmpeg.c
(cherry picked from commit 1d1adf5ff42041810d4069ce03303706fbf13d8a)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agopthread_frame: forward error codes when flushing
Andreas Cadhalpun [Tue, 30 Jun 2015 19:01:29 +0000 (21:01 +0200)]
pthread_frame: forward error codes when flushing

This is the first part of the fix for ticket #4370.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agohuffyuvdec: validate image size
Andreas Cadhalpun [Sun, 28 Jun 2015 09:21:54 +0000 (11:21 +0200)]
huffyuvdec: validate image size

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agowavpack: use get_bits_long to read up to 32 bits
Andreas Cadhalpun [Sat, 27 Jun 2015 18:16:12 +0000 (20:16 +0200)]
wavpack: use get_bits_long to read up to 32 bits

get_bits should not be used for more than 25 bits.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agonutdec: check maxpos in read_sm_data before returning success
Andreas Cadhalpun [Sat, 27 Jun 2015 15:50:56 +0000 (17:50 +0200)]
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 6b9fdf7f4f07926557048070cc2af3cfd0e3fe50)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit eddf146ada12b394a7796af12bff2121505dc4a1)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agovc1dec: use get_bits_long and limit the read bits to 32
Andreas Cadhalpun [Thu, 25 Jun 2015 20:47:38 +0000 (22:47 +0200)]
vc1dec: use get_bits_long and limit the read bits to 32

get_bits should not be used with more than 25 bits.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agompegaudiodec: copy AVFloatDSPContext from first context to all contexts
Andreas Cadhalpun [Thu, 25 Jun 2015 22:27:54 +0000 (00:27 +0200)]
mpegaudiodec: copy AVFloatDSPContext from first context to all contexts

This fixes a segfault when decoding multi-channel MP3onMP4 files.

This is similar to commit cb72230d for MPADSPContext.

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoUpdate for 2.6.4
Michael Niedermayer [Mon, 20 Jul 2015 09:10:34 +0000 (11:10 +0200)]
Update for 2.6.4

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/vp8: Check buffer size in vp8_decode_frame_header()
Michael Niedermayer [Sat, 18 Jul 2015 17:18:24 +0000 (19:18 +0200)]
avcodec/vp8: Check buffer size in vp8_decode_frame_header()

avoids null pointer dereference
Fixes: signal_sigsegv_d5de40_964_vp80-00-comprehensive-010.ivf with memlimit of 1048576

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()
Michael Niedermayer [Sat, 18 Jul 2015 17:02:26 +0000 (19:02 +0200)]
avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()

Fixes: signal_sigsegv_d5de23_967_vp80_00_comprehensive_010.ivf with memlimit 524288

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/diracdec: Check for hpel_base allocation failure
Michael Niedermayer [Sat, 18 Jul 2015 15:55:19 +0000 (17:55 +0200)]
avcodec/diracdec: Check for hpel_base allocation failure

Fixes null pointer dereference
Fixes: signal_sigsegv_b02a96_280_RL_420p_ffdirac.drc with memlimit of 67108864

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()
Michael Niedermayer [Sat, 18 Jul 2015 09:24:45 +0000 (11:24 +0200)]
avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()

Avoids leaving stale pointers
Fixes: signal_sigabrt_7ffff70eccc9_819_sabtriple.rm with memlimit 536870912

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/af_aresample: Check ff_all_* for allocation failures
Michael Niedermayer [Fri, 17 Jul 2015 18:27:25 +0000 (20:27 +0200)]
avfilter/af_aresample: Check ff_all_* for allocation failures

Fixes: signal_sigabrt_7ffff70eccc9_498_divx502.avi with memlimit 1572864

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/pthread_frame: clear priv_data, avoid stale pointer in error case
Michael Niedermayer [Thu, 16 Jul 2015 09:52:33 +0000 (11:52 +0200)]
avcodec/pthread_frame: clear priv_data, avoid stale pointer in error case

Fixes: b4b47bc2b3fb7ca710bfffe5aa969e37_signal_sigabrt_7ffff70eccc9_744_nc_sample2.avi with memlimit of 4194304

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoswscale/utils: Clear pix buffers
Michael Niedermayer [Wed, 15 Jul 2015 17:20:19 +0000 (19:20 +0200)]
swscale/utils: Clear pix buffers

Fixes use of uninitialized memory
Fixes: a96874b9466b6edc660a519c7ad47977_signal_sigsegv_7ffff713351a_744_nc_sample.avi with memlimit 2147483648

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_g...
Zhang Rui [Tue, 14 Jul 2015 06:47:26 +0000 (14:47 +0800)]
avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoffmpeg: Fix cleanup after failed allocation of output_files
Michael Niedermayer [Tue, 14 Jul 2015 13:49:41 +0000 (15:49 +0200)]
ffmpeg: Fix cleanup after failed allocation of output_files

Fixes: 39a25908b84604acdaa490138282d091_signal_sigsegv_7ffff713351a_331_WAWV.avi 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 6e80fe1ecd984a59bb6c73cbb436cc06536b7728)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mov: Fix deallocation when MOVStreamContext failed to allocate
Michael Niedermayer [Tue, 14 Jul 2015 12:14:16 +0000 (14:14 +0200)]
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 15629129dde771446a005282ee33c4ea1199e696)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoffmpeg: Fix crash with ost->last_frame allocation failure
Michael Niedermayer [Tue, 14 Jul 2015 11:02:19 +0000 (13:02 +0200)]
ffmpeg: Fix crash with ost->last_frame allocation failure

Fixes: 1013dbde2c360d939cc2dfc33e4f275c_signal_sigsegv_a0500f_45_320vp3.nsv with memlimit of 536870912

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoffmpeg: Fix cleanup with ost = NULL
Michael Niedermayer [Mon, 13 Jul 2015 21:33:18 +0000 (23:33 +0200)]
ffmpeg: Fix cleanup with ost = NULL

Fixes: 09e670595acbdafb226974b08dab66e3_signal_sigabrt_7ffff70eccc9_991_xtrem_e2_m64q15_a32sxx.3gp with memlimit of 1048576

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/pthread_frame: check avctx on deallocation
Michael Niedermayer [Mon, 13 Jul 2015 19:19:04 +0000 (21:19 +0200)]
avcodec/pthread_frame: check avctx on deallocation

Fixes null pointer dereferences
Fixes: af1a5a33e67e479f439239097bd0d4fd_signal_sigsegv_7ffff713351a_152_Dolby_Rain_Logo.pmp with memlimit of 8388608

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/sanm: Reset sizes in destroy_buffers()
Michael Niedermayer [Mon, 13 Jul 2015 14:05:21 +0000 (16:05 +0200)]
avcodec/sanm: Reset sizes in destroy_buffers()

Fixes crash in 1288a2fe8e9ae6b00ca40e089d08ca65_signal_sigsegv_7ffff71426a7_354_accident.san with allocation limit 65536

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/alac: Clear pointers in allocate_buffers()
Michael Niedermayer [Mon, 13 Jul 2015 13:46:10 +0000 (15:46 +0200)]
avcodec/alac: Clear pointers in allocate_buffers()

Fixes: 06a4edb39ad8a9883175f9bd428334a2_signal_sigsegv_7ffff713351a_706_mov__alac__ALAC_6ch.mov

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agobytestream2: set the reader to the end when reading more than available
Anton Khirnov [Fri, 10 Jul 2015 07:31:24 +0000 (09:31 +0200)]
bytestream2: set the reader to the end when reading more than available

This prevents possible infinite loops with the calling code along the
lines of while (bytestream2_get_bytes_left()) { ... }, where the reader
does not advance.

CC: libav-stable@libav.org
(cherry picked from commit 86eee85daddb682fa072c2e2657c90a514b855e3)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/utils: use a minimum 32pixel width in avcodec_align_dimensions2() for H.264
Michael Niedermayer [Fri, 10 Jul 2015 00:01:17 +0000 (02:01 +0200)]
avcodec/utils: use a minimum 32pixel width in  avcodec_align_dimensions2() for H.264

Fixes Assertion failure
Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7ef6656b1e5bfbc7499013d3b38b093b6b2f31ec)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/mpegvideo: Clear pointers in ff_mpv_common_init()
Michael Niedermayer [Thu, 9 Jul 2015 20:16:15 +0000 (22:16 +0200)]
avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

This ensures that no stale pointers leak through on any path

Fixes: signal_sigsegv_c3097a_991_xtrem_e2_m64q15_a32sxx.3gp

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agooggparsedirac: check return value of init_get_bits
Chris Watkins [Tue, 7 Jul 2015 17:23:44 +0000 (10:23 -0700)]
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 4f5c2e651a95b950f6a3fb36f2342cbc32515f17)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agowmalosslessdec: reset frame->nb_samples on packet loss
Andreas Cadhalpun [Thu, 2 Jul 2015 22:02:44 +0000 (00:02 +0200)]
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 42e7a5b3c704985c2c18970cc94a837b413df9d9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agowmalosslessdec: avoid reading 0 bits with get_bits
Andreas Cadhalpun [Thu, 2 Jul 2015 22:01:56 +0000 (00:01 +0200)]
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 f9020d514e9ed5043496a710b36daba1ab182e97)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/rawenc: Use ff_alloc_packet() instead of ff_alloc_packet2()
Michael Niedermayer [Sun, 5 Jul 2015 18:00:15 +0000 (20:00 +0200)]
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 47496eb97cff8130991313d1b7292613620d8592)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/aacsbr: Assert that bs_num_env is positive
Michael Niedermayer [Wed, 1 Jul 2015 00:08:25 +0000 (02:08 +0200)]
avcodec/aacsbr: Assert that bs_num_env is positive

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/aacsbr: check that the element type matches before applying SBR
Michael Niedermayer [Wed, 1 Jul 2015 00:05:43 +0000 (02:05 +0200)]
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 79a98294da6cd85f8c86b34764c5e0c43b09eea3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/h264_slice: Use w/h from the AVFrame instead of mb_w/h
Michael Niedermayer [Tue, 30 Jun 2015 17:37:12 +0000 (19:37 +0200)]
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 330863c9f19a23c500ba7901a23f1cc377b353bb)

Conflicts:

libavcodec/h264_slice.c

4 years agovp9/update_prob: prevent out of bounds table read
James Zern [Tue, 30 Jun 2015 06:03:14 +0000 (23:03 -0700)]
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 e91f860ea74e11e9178500fe8794c47f57dbf48c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavfilter/vf_transpose: Fix rounding error
Michael Niedermayer [Tue, 30 Jun 2015 14:01:15 +0000 (16:01 +0200)]
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 0083c16605aa5997534e87e68f97ef85a8c3b7b8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/pngdec: Check values before updating context in decode_fctl_chunk()
Michael Niedermayer [Mon, 29 Jun 2015 20:32:02 +0000 (22:32 +0200)]
avcodec/pngdec: Check values before updating context in decode_fctl_chunk()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/pngdec: Require a IHDR chunk before fctl
Michael Niedermayer [Mon, 29 Jun 2015 19:57:12 +0000 (21:57 +0200)]
avcodec/pngdec: Require a IHDR chunk before fctl

This is required by the APNG spec

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

Conflicts:

libavcodec/pngdec.c

4 years agoavcodec/pngdec: Only allow one IHDR chunk
Michael Niedermayer [Mon, 29 Jun 2015 19:08:05 +0000 (21:08 +0200)]
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 47f4e2d8960ca756ca153ab8e3e93d80449b8c91)

Conflicts:

libavcodec/pngdec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agowmavoice: limit wmavoice_decode_packet return value to packet size
Andreas Cadhalpun [Sun, 28 Jun 2015 10:40:12 +0000 (12:40 +0200)]
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 2a4700a4f03280fa8ba4fc0f8a9987bb550f0d1e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswscale/swscale_unscaled: Fix rounding difference with RGBA output between little...
Michael Niedermayer [Mon, 29 Jun 2015 11:51:43 +0000 (13:51 +0200)]
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 f6ab967eae497733f6adc12b30075980fd6eea98)

Conflicts:

tests/ref/fate/dds-rgb16

4 years agoffmpeg: Do not use the data/size of a bitstream filter after failure
Michael Niedermayer [Wed, 24 Jun 2015 11:27:39 +0000 (13:27 +0200)]
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 8f0f678f090d9939b0014ba85641e2cb83d39cb8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswscale/x86/rgb2rgb_template: fix signedness of v in shuffle_bytes_2103_{mmx,mmxext}
James Almer [Tue, 23 Jun 2015 04:15:07 +0000 (01:15 -0300)]
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 e22edbfd413242dda720dc5191fc00a51c24d74c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswscale/x86/rgb2rgb_template: add missing xmm clobbers
James Almer [Tue, 23 Jun 2015 04:14:16 +0000 (01:14 -0300)]
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 910eeab48026060b5f7780b2560445c069eb4d6b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agovda: unlock the pixel buffer base address.
Sebastien Zwickert [Sat, 20 Jun 2015 11:19:29 +0000 (13:19 +0200)]
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 c06fdacc3dc706e70d953917fea845532d3703ca)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()
Michael Niedermayer [Tue, 23 Jun 2015 03:09:11 +0000 (05:09 +0200)]
swscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix shuffle_bytes_2103_c...
Michael Niedermayer [Tue, 23 Jun 2015 02:36:02 +0000 (04:36 +0200)]
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 abb833c5681b84d7025c083e2191140eaa30dca7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswscale/rgb2rgb_template: Disable shuffle_bytes_2103_c on big endian
Michael Niedermayer [Mon, 22 Jun 2015 20:23:22 +0000 (22:23 +0200)]
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 4df3cf90bf7a54793e90304bd1b6c7599673f36a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswr: Remember previously set int_sample_format from user
Michael Niedermayer [Mon, 22 Jun 2015 16:27:27 +0000 (18:27 +0200)]
swr: Remember previously set int_sample_format from user

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agomatroskadec: check audio sample rate
Andreas Cadhalpun [Mon, 15 Jun 2015 18:59:22 +0000 (20:59 +0200)]
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 5b76c82fd7a5f4f36bb901b8c43d7f7319599599)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agomatroskadec: validate audio channels and bitdepth
Andreas Cadhalpun [Mon, 15 Jun 2015 19:06:51 +0000 (21:06 +0200)]
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 92e79a2f7bf2f8bb0cb2d1a3e4d76737557071c4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/dpxenc: implement write16/32 as functions
Michael Niedermayer [Fri, 19 Jun 2015 14:46:06 +0000 (16:46 +0200)]
avcodec/dpxenc: implement write16/32 as functions

Fixes undefined behavior and segfault

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agopostproc: fix unaligned access
Andreas Cadhalpun [Thu, 18 Jun 2015 18:15:12 +0000 (20:15 +0200)]
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 590743101dc934043f34013f1c9bb9fb261355b0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoffmpeg: Free last_frame instead of just unref
Michael Niedermayer [Thu, 18 Jun 2015 03:27:08 +0000 (05:27 +0200)]
ffmpeg: Free last_frame instead of just unref

Fixes Ticket4611

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

Conflicts:

ffmpeg.c

4 years agoavio: fix potential crashes when combining ffio_ensure_seekback + crc
wm4 [Tue, 16 Jun 2015 22:21:02 +0000 (00:21 +0200)]
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)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoexamples/demuxing_decoding: use properties from frame instead of video_dec_ctx
Andreas Cadhalpun [Sun, 14 Jun 2015 18:34:16 +0000 (20:34 +0200)]
examples/demuxing_decoding: use properties from frame instead of video_dec_ctx

This is more robust.

And only check if there is actually a frame returned.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoh264: er: Copy from the previous reference only if compatible
Andreas Cadhalpun [Sun, 14 Jun 2015 10:40:18 +0000 (12:40 +0200)]
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 fdc64a104410f5fcc7f35b62287b0ae502b7061a)

Conflicts:

libavcodec/h264_slice.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agosonic: set avctx->channels in sonic_decode_init
Andreas Cadhalpun [Tue, 9 Jun 2015 20:41:24 +0000 (22:41 +0200)]
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 58995f647b5fa2e1efa33ae4f8b8a76a81ec99df)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agovp8: change mv_{min,max}.{x,y} type to int
Andreas Cadhalpun [Mon, 8 Jun 2015 20:38:29 +0000 (22:38 +0200)]
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 6fdbaa2b7fb56623ab2163f861952bc1408c39b3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agovp9: change type of tile_size from unsigned to int64_t
Andreas Cadhalpun [Sun, 7 Jun 2015 16:50:43 +0000 (18:50 +0200)]
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 b18eac7ff22332c9344769af15f7b245dd13cc64)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoarm: only enable setend on ARMv6
Andreas Cadhalpun [Thu, 4 Jun 2015 21:07:44 +0000 (23:07 +0200)]
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 5bf84a584e9ce681b439a5747671e2809a019c83)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agolibopenjpegdec: check existence of image component data
Andreas Cadhalpun [Sat, 30 May 2015 14:18:48 +0000 (16:18 +0200)]
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 3ef5702926c495232ffe685303ba8661bdff1149)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agomov: abort on EOF in ff_mov_read_chan
Andreas Cadhalpun [Sat, 23 May 2015 21:32:12 +0000 (23:32 +0200)]
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>
4 years agoffmpeg_opt: Check for localtime() failure
Michael Niedermayer [Fri, 12 Jun 2015 13:36:20 +0000 (15:36 +0200)]
ffmpeg_opt: Check for localtime() failure

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavformat: Fix bug in parse_rps for HEVC.
Deliang Fu [Wed, 10 Jun 2015 04:30:46 +0000 (12:30 +0800)]
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>
4 years agotakdec: ensure chan2 is a valid channel index
Andreas Cadhalpun [Tue, 9 Jun 2015 22:12:38 +0000 (00:12 +0200)]
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 05c57ba2f42324da2fdc93d83d65bb68dd637613)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/h264_slice: Use AVFrame diemensions for grayscale handling
Michael Niedermayer [Wed, 10 Jun 2015 09:37:48 +0000 (11:37 +0200)]
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 aef0e0f009802f1a5e21eb6465498632071e4475)

Conflicts:

libavcodec/h264_slice.c

4 years agoavdevice/lavfi: do not rescale AV_NOPTS_VALUE in lavfi_read_packet()
Michael Niedermayer [Tue, 9 Jun 2015 22:47:43 +0000 (00:47 +0200)]
avdevice/lavfi: do not rescale AV_NOPTS_VALUE in lavfi_read_packet()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agolibavutil/channel_layout: Correctly return layout when channel specification ends...
Simon Thelen [Tue, 9 Jun 2015 02:55:57 +0000 (04:55 +0200)]
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 83307a32eb0c9f0843f655c44bb65e3e999153f8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/jpeg2000dec: Check that coords match before applying ICT
Michael Niedermayer [Mon, 8 Jun 2015 22:37:26 +0000 (00:37 +0200)]
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 12ba1b2b4d5592c0e27b0fcc83db929e8d6a8eee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavformat/ffmdec: Check ffio_set_buf_size() return value
Michael Niedermayer [Sun, 7 Jun 2015 12:55:10 +0000 (14:55 +0200)]
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>
4 years agoavcodec/adpcm: Check for overreads
Michael Niedermayer [Thu, 4 Jun 2015 20:34:12 +0000 (22:34 +0200)]
avcodec/adpcm: Check for overreads

See: vlc ticket 14649
Reported-by: carl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3c803ed9cb23e5a8d76b6c31d8a8c71cac27e769)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/alsdec: Check for overread
Michael Niedermayer [Thu, 4 Jun 2015 20:59:34 +0000 (22:59 +0200)]
avcodec/alsdec: Check for overread

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/atrac3plusdec: consume only as many bytes as available
Michael Niedermayer [Thu, 4 Jun 2015 20:47:24 +0000 (22:47 +0200)]
avcodec/atrac3plusdec: consume only as many bytes as available

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agolibavutil/softfloat: Fix av_normalize1_sf bias.
Nedeljko Babic [Wed, 3 Jun 2015 14:17:39 +0000 (16:17 +0200)]
libavutil/softfloat: Fix av_normalize1_sf bias.

av_normalize1_sf doesn't properly address border case when mantis is
exactly -0x40000000.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswresample/swresample: Cleanup on init failure.
Michael Niedermayer [Thu, 4 Jun 2015 01:47:55 +0000 (03:47 +0200)]
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 c3f87f7545d42520921bc448b9fbd7324c574e49)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoRevert "avformat/rtpenc: check av_packet_get_side_data() return, fix null ptr derefer...
Michael Niedermayer [Wed, 3 Jun 2015 20:39:27 +0000 (22:39 +0200)]
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>
4 years agoavformat/mxfenc: Accept MXF D-10 with 49.999840 Mbit/sec
Michael Niedermayer [Mon, 1 Jun 2015 19:35:02 +0000 (21:35 +0200)]
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>
4 years agoswresample/dither: check memory allocation
Ganesh Ajjanagadde [Wed, 3 Jun 2015 03:17:48 +0000 (23:17 -0400)]
swresample/dither: check memory allocation

check memory allocation in swri_get_dither()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agolibopenjpegenc: add NULL check for img before accessing it
Andreas Cadhalpun [Sun, 31 May 2015 22:51:30 +0000 (00:51 +0200)]
libopenjpegenc: add NULL check for img before accessing it

If opj_image_create fails to allocate an image it returns NULL, which
causes a segmentation fault at 'img->x0 = 0'.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoswresample: Check the return value of resampler->init()
Michael Niedermayer [Tue, 2 Jun 2015 22:48:29 +0000 (00:48 +0200)]
swresample: Check the return value of resampler->init()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoh264: Make sure reinit failures mark the context as not initialized
Luca Barbato [Mon, 25 May 2015 20:30:10 +0000 (22:30 +0200)]
h264: Make sure reinit failures mark the context as not initialized

(cherry picked from commit 0181ae9af2de1526464d23209b82e6674d362f5d)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavfilter/x86/vf_fspp: Fix invalid combination of opcode and operands
Michael Niedermayer [Mon, 25 May 2015 23:37:39 +0000 (01:37 +0200)]
avfilter/x86/vf_fspp: Fix invalid combination of opcode and operands

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoffmpeg_opt: Set the video VBV parameters only for the video stream from -target
Michael Niedermayer [Mon, 25 May 2015 10:13:53 +0000 (12:13 +0200)]
ffmpeg_opt: Set the video VBV parameters only for the video stream from -target

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/bitstream: Assert that there is enough space left in avpriv_copy_bits()
Michael Niedermayer [Mon, 25 May 2015 01:48:45 +0000 (03:48 +0200)]
avcodec/bitstream: Assert that there is enough space left in avpriv_copy_bits()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/put_bits: Assert that there is enough space left in skip_put_bytes()
Michael Niedermayer [Mon, 25 May 2015 01:45:38 +0000 (03:45 +0200)]
avcodec/put_bits: Assert that there is enough space left in skip_put_bytes()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/mpegvideo_enc: Update the buffer size as more slices are merged
Michael Niedermayer [Mon, 25 May 2015 02:54:41 +0000 (04:54 +0200)]
avcodec/mpegvideo_enc: Update the buffer size as more slices are merged

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavcodec/put_bits: Update size_in_bits in set_put_bits_buffer_size()
Michael Niedermayer [Mon, 25 May 2015 02:53:09 +0000 (04:53 +0200)]
avcodec/put_bits: Update size_in_bits in set_put_bits_buffer_size()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavformat/wavdec: Increase dts packet threshold to fix more misdetections
Rodger Combs [Sat, 23 May 2015 12:07:14 +0000 (14:07 +0200)]
avformat/wavdec: Increase dts packet threshold to fix more misdetections

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agoavformat/wavdec: Increase probe_packets limit
Michael Niedermayer [Sat, 23 May 2015 10:03:38 +0000 (12:03 +0200)]
avformat/wavdec: Increase probe_packets limit

Fixes DTS detection of b2429e5ba9.dts

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
4 years agonutdec: abort if EOF is reached in decode_info_header/read_sm_data
Andreas Cadhalpun [Tue, 19 May 2015 22:34:42 +0000 (00:34 +0200)]
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>
4 years agonutdec: stop skipping bytes at EOF
Andreas Cadhalpun [Tue, 19 May 2015 22:31:24 +0000 (00:31 +0200)]
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>
4 years agonutdec: fix infinite resync loops
Andreas Cadhalpun [Tue, 19 May 2015 22:06:05 +0000 (00:06 +0200)]
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>
4 years agoavformat/nutdec: Check X in 2nd branch of index reading
Michael Niedermayer [Fri, 22 May 2015 22:23:05 +0000 (00:23 +0200)]
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>