avcodec/dxa: check dimensions

Fixes out of array access
Fixes: asan_heap-oob_11222fb_21_020.dxa
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/mvdec: Check size for validity in var_read_string()

Fixes out of array read
Fixes: asan_heap-oob_49b1e5_12_011.movie
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/mvdec: Check size in read_table() for validity

This check is redundant with the previous commit but it provides
better error messages and feedback while the previous commit
ensures that var_read_string() doesnt return uninitialized arrays
if it itself is feeded with an invalid size possibly through a
different future codepath.

Fixes: asan_heap-oob_49b1e5_12_011.movie
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mxfdec: Break out parts of mxf_read_header() into separate functions

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mxfdec: Parse PreviousPartition in mxf_seek_to_previous_partition()

Without this patch the demuxer can get stuck in a loop if PreviousPartition
points somewhere where there's no PartitionPack, or if klv_read_packet() syncs
back up to the current partition.

This should fix Ticket3278 properly and unbreak Ticket4040.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Revert "avformat/mxfdec: detect loops during header parsing"

This reverts commit 1c010fd035c1a14dc73827b84f21f593e969a5d6.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mxfdec: Merge last_partition and footer_partition

FooterPartition offset specified in RIP takes precedence over any value written
in PartitionPacks. This fixes the same issue f06f6da tries to fix without
introducing an extra variable.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mxfdec: Tighten RIP length bounds in mxf_read_random_index_pack()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/dnxhddec: treat pix_fmt like width/height

Fixes out of array accesses
Fixes: asan_heap-oob_22c9a39_16_015.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Do not set the lame quality if the user didn't request it.

This makes FFmpeg's mp3 output more similar to lame's output.
Print a warning if a subtitle demuxer changes utf16 to utf8.

This does not fix anything but gives users a chance to
know that they must not pass -sub_charenc UTF-16 to ffmpeg.

Fixes ticket #4059.
Use v4l2 input format automatically if filename starts with "/dev/video"

Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Mention in the documentation that fieldmatch needs cfr input.

This can be improved in the decimate filter but for the moment
explicitely mentioning that mixed telecined and progressive
content is unsupported is an improvement.

Fixes ticket #3968.
Merge remote-tracking branch 'cehoyos/master'

* cehoyos/master:
  Mention in the documentation that fieldmatch needs cfr input.
  Use v4l2 input format automatically if filename starts with "/dev/video"
  Print a warning if a subtitle demuxer changes utf16 to utf8.
  Do not set the lame quality if the user didn't request it.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
avformat/mxfdec: fix null pointer dereference

Fixes: signal_sigsegv_b5b3d4_2_001.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Improve the fieldmatch documentation about mixed telecined content.

The fieldmatch filter has no problem with mixed telecined and
progressive content but the decimate filter does not detect the
changing framerate and drops progressive frames.
avformat/mxfenc: AVC Intra support

To keep h264 parsing simple and fast, I used the framesize for selecting the right Panasonic codec label. The framesize is fixed for Panasonic AVC Intra.

This patch only supports AVCI50/100. But in all flavours, i.e. with no SPS/PPS in header.

Reviewed-by: tomas.hardin@codemill.se
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/libutvideodec: Try to fix build failure with old libutvideo

Found-by: Jan Ehrhardt <phpdev@ehrhardt.nl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/utils: Align dimensions by at least their chroma sub-sampling factors.

Fixes: out of array accesses
Fixes: asan_heap-oob_112c6b3_13_012.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
lavd/v4l2: don't use avpriv_ prefix for internal functions

No need to keep the old symbols around until a major bump since lavd functions
with the avpriv_ prefix were never exposed.

Signed-off-by: James Almer <jamrial@gmail.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>