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

99710 Commits

Author SHA1 Message Date
Marton Balint
2933ee8ff0 avformat/mpegts: make sure mpegts_resync do not run out of the initially requested probe buffer
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-09 21:07:18 +02:00
Marton Balint
a3943c4847 avformat/aviobuf: fix checks in ffio_ensure_seekback
The new buf_size was detemined too conservatively, maybe because of the
off-by-one issue which was fixed recently in fill_buffer. We can safely
substract 1 more from the new buffer size, because max_buffer_size space must
only be guaranteed when we are reading the last byte of the requested window.

Comparing the new buf_size against filled did not make a lot of sense, what
makes sense is that we want to reallocate the buffer if the new buf_size is
bigger than the old, therefore the change in the check.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-09 21:07:18 +02:00
Marton Balint
6d972beb23 avformat/aviobuf: check if requested seekback buffer is already read
Existing code did not check if the requested seekback buffer is
already read entirely. In this case, nothing has to be done to guarantee
seekback.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-09 21:07:18 +02:00
Marton Balint
74c70efd12 avformat/aviobuf: write data into the IO buffer till the very end of the buffer
There was an off-by-one error when checking if the IO buffer still has enough
space till the end. One more byte can be safely written.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-09 21:07:18 +02:00
Andreas Rheinhardt
358c0bb168 avfilter/vf_minterpolate: Remove redundant code for freeing
ad73b32d29 added some code for freeing in
the input's config_props function, yet this is unnecessary as uninit is
called anyway if config_props fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-09 16:38:28 +02:00
Andreas Rheinhardt
aa262dcce8 avfilter/vf_minterpolate: Fix left shift of negative value
This has happened when initializing the motion estimation context if
width or height of the video was smaller than the block size used
for motion estimation and if the motion interpolation mode indicates
not to use motion estimation.

The solution is of course to only initialize the motion estimation
context if the interpolation mode uses motion estimation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-09 16:38:28 +02:00
Andreas Rheinhardt
bb13cdbe27 avfilter/vf_minterpolate: Reject too small dimensions
The latter code relies upon the dimensions to be not too small;
otherwise one will call av_clip() with min > max lateron which aborts
in case ASSERT_LEVEL is >= 2 or one will get a nonsense result that may
lead to a heap-buffer-overflow/underflow. The latter has happened in
ticket #8248 which this commit fixes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-09 16:38:28 +02:00
Andriy Gelman
0d156eb58a avformat/rtsp: allocate correct max number of pollfds
There is one general rtsp connection plus two connections per stream (rtp/rtcp).

Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-10-08 23:18:18 -04:00
Andriy Gelman
b4103e0eb6 avformat/rtspdec: add newline in log message
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-10-08 23:18:18 -04:00
Peter Ross
9553c0b46a FATE/dnn: only run unit test when CONFIG_DNN enabled
Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2020-10-09 08:35:45 +08:00
Andreas Rheinhardt
32f0a000fd avcodec/magicyuvenc: Use more correct cast in compare function
There is no need to cast const away (even if it was harmless) and to
copy the object at all.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-09 01:17:02 +02:00
Andreas Rheinhardt
17b003a9e2 avcodec/magicyuvenc: Avoid sorting Huffman table unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-09 01:17:02 +02:00
Andreas Rheinhardt
dc3f177b8f avcodec/mjpegdec: Remove redundant initialization
Now that the correct number of codes is used, it is no longer necessary
to initialize the lengths of the codes at all any more as the length of
the actually used codes is set later anyway.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-09 01:17:02 +02:00
Andreas Rheinhardt
ea5016cd11 avcodec/mjpegdec: Remove use_static from build_vlc()
It is always zero; it referred to the INIT_VLC_USE_STATIC flag which has
been removed in 595324e143.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-09 01:16:02 +02:00
Andreas Rheinhardt
39ab256125 avformat/libopenmpt: Don't discard const
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-08 22:56:31 +02:00
Andreas Rheinhardt
a21dec5d0a avcodec/mjpegdec: Use correct number of codes when init default VLCs
Commit bbc0d0c1fe made the mjpeg decoder
use default Huffman tables when none are given, yet when initializing
the default Huffman tables, it did not use the correct number of entries
of the arrays used to initialize the tables, but instead it used the
biggest entry + 1 (as if it were a continuous array 0..biggest entry).
This worked because the ff_init_vlc_sparse() (and its predecessors)
always skipped entries with a length of zero and the length of the
corresponding elements was always initialized to zero with only the
sizes of the actually existing elements being set to a size > 0 lateron.

Yet since commit 1249698e1b this is no
longer so, as build_vlc() actually read the array containing the values
itself. This implies that the wrong length now leads to a read beyond
the end of the given array; this could lead to crashs (but usually
doesn't); it is detectable by ASAN* and this commit fixes it.

*: AddressSanitizer: global-buffer-overflow on address xy
...
xy is located 0 bytes to the right of global variable 'avpriv_mjpeg_val_ac_luminance'

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-08 20:34:32 +02:00
Andreas Rheinhardt
a2ccfc6bb1 avcodec/mjpegdec: Use correct number of codes for VLC tables
Commit 1249698e1b made
ff_mjpeg_decode_dht() call build_vlc() with a wrong (too hight)
number of codes. The reason it worked is that the lengths of the extraneous
entries is initialized to zero and ff_init_vlc_sparse() ignores codes
with a length of zero. But using a too high number of codes was
nevertheless bad, because a) the assert in build_vlc() could have been
triggered (namely if the real amount of codes is 256) and b) the loop in
build_vlc() uses initialized data (leading to Valgrind errors [1]).
Furthermore, the old code spend CPU cycles in said loop although the
result won't be used anyway.

[1]: http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-valgrind&time=20201008025137

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-08 20:33:50 +02:00
ManojGuptaBonda
ccca62ef99 VP9 Profile 2 VDPAU support
Added VDPAU to list of supported formats for VP9 420 10 and 12 bit
formats. Add VP9 10/12 Bit support for VDPAU

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-10-08 11:18:14 -07:00
Andreas Rheinhardt
616eb93a40 avformat/dashdec: Reset pointer to NULL after freeing it
This is currently safe here, because the effective lifetime of
adaptionset_lang is parse_manifest_adaptationset() (i.e. the pointer
gets overwritten each time on entry to the function and gets freed
before exiting the function), but it is nevertheless safer to reset the
pointer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-08 15:40:02 +02:00
James Almer
e9521d9298 configure: add missing atsc_a53 dependencies to hevcparse and h264_parser
Found-by: Chris Miceli <chris@miceli.net.au>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-08 10:15:18 -03:00
Christopher Degawa
0117d5aa03 libavformat/dashdec: Fix issue with dash on Windows
Use xmlFree instead of av_freep

snip from libxml2:

 * xmlGetProp:
...
 * Returns the attribute value or NULL if not found.
 *     It's up to the caller to free the memory with xmlFree().

According to libxml2, you are supposed to use xmlFree instead of free
on the pointer returned by it, and also using av_freep on Windows will
call _aligned_free instead of normal free, causing _aligned_free to raise
SIGTRAP and crashing ffmpeg and ffplay.

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2020-10-08 10:05:09 -03:00
Carl Eugen Hoyos
bc43588a71 lavf/img2dec: Auto-detect Cintel scanner images. 2020-10-08 09:34:55 +02:00
Paul B Mahol
1249698e1b avcodec/mjpegdec: improve decoding of DNG files
That have unused symbols coded in DHT.
2020-10-07 22:16:35 +02:00
Paul B Mahol
da5b3d0028 avcodec/tiff: do not abort decoding if strips are available
Even if such files are invalid, they can be decoded just fine.
Also stored tiles may have bigger dimensions than displayed ones,
so do not abort decoding in such cases.
2020-10-07 22:16:35 +02:00
Paul B Mahol
283f950a65 avcodec: add Cintel RAW decoder 2020-10-07 22:16:09 +02:00
Paul B Mahol
a086b73e1f avfilter/vf_v360: use quaternions for rotation
Fixes gimbal lock issues, and round-off errors.
2020-10-07 01:54:05 +02:00
Mark Reid
a48adcd136 libswcale/input: use more accurate planer rgb16 yuv conversions
These conversion appears to be exhibiting the same rounding error as the rgbf32 formats where.
I seperated the rounding value from the 16 and 128 offsets, I think it makes it a little more clear.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-06 17:56:52 +02:00
James Almer
214998c55f avcodec/av1dec: avoid probing with av1dec
av1dec should no longer attempt to output empty frames if another decoder
was used for probing and it sucessfully set a pix_fmt ever since 05872c67a4,
so we can re-add the AV_CODEC_CAP_AVOID_PROBING cap.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-06 11:28:12 -03:00
hwren
1e97fbb3b6 lavf/avs2dec.c: optimize code style
Signed-off-by: hwren <hwrenx@126.com>
2020-10-06 00:01:35 +08:00
hwren
de0a555898 lavc/avs2_parser.c: optimize code style
Signed-off-by: hwren <hwrenx@126.com>
2020-10-06 00:01:34 +08:00
hwren
b15e875c8c lavf/davs2.c: rename as avs2dec.c for better understanding
Signed-off-by: hwren <hwrenx@126.com>
2020-10-06 00:01:34 +08:00
hwren
026be690e6 lavc/avs2_parser.c,lavf/davs2.c: add AVS2_* prefix
Add AVS2_* prefix to macro definitions to avoid confusion

Signed-off-by: hwren <hwrenx@126.com>
2020-10-06 00:01:34 +08:00
hwren
c952db9d68 lavc,doc: add libuavs3d video decoder wrapper
Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
2020-10-06 00:01:33 +08:00
hwren
ff74ad2a4b lavf/avs3dec: add raw avs3 demuxer
Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
2020-10-06 00:01:27 +08:00
hwren
6223d77578 lavc/avs3_parser: add avs3 parser
Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
2020-10-05 23:10:13 +08:00
hwren
38fd8044e6 lavc/avs3.h: add AVS3 related definitions
Signed-off-by: hwren <hwrenx@126.com>
2020-10-05 23:10:13 +08:00
hwren
8e74d98a29 lavc: add AVS3 codec id and desc
Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
2020-10-05 23:10:13 +08:00
James Almer
0b6541368d avcodec/h264_slice: use av_buffer_replace() to simplify code
Based on eff289ce9f.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-05 11:20:17 -03:00
Andreas Rheinhardt
290de64759 avformat/movenc: Avoid allocation for timecode track
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-05 00:50:07 +02:00
Andreas Rheinhardt
e3b5316bed avformat/movenc: Don't forget to free fragment buffers
The buffers used when fragmented output is enabled have up until now not
been freed in the deinit function; they leak e.g. if one errors out of
mov_write_trailer() before one reaches the point where they are normally
written out and freed. This can e.g. happen if allocating new vos_data
fails at the beginning of mov_write_trailer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-05 00:49:31 +02:00
Andreas Rheinhardt
432f291dff avformat/movenc: Free old vos_data before overwriting it
Otherwise the old data leaks whenever extradata needs to be rewritten
(e.g. when encoding FLAC with our encoder that sends an updated
extradata packet at the end).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-05 00:49:11 +02:00
Andreas Rheinhardt
0336bbf68a avformat/movenc: Don't free AVCodecParameters manually
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-05 00:48:55 +02:00
Andreas Rheinhardt
c9ceec1f1f avcodec/qsv: Fix leak of options on error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-05 00:48:47 +02:00
Andreas Rheinhardt
e6cdd23bc7 avformat/movenc: Make some AVCodecTag tables static
They are not used anywhere else.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-04 23:41:26 +02:00
Andreas Rheinhardt
22c3cd1760 avformat/movenc: Fix segfault when remuxing rtp hint stream
When remuxing an rtp hint stream (or any stream with the tag "rtp "),
the mov muxer treats this as one of the rtp hint tracks it creates
internally when ordered to do so; yet this track lacks the
AVFormatContext for the hinting rtp muxer, leading to segfaults in
mov_write_udta_sdp() if a "trak" atom is written for this stream; if not,
the stream's codecpar is freed by mov_free() as if the mov muxer owned
it (it does for the internally created "rtp " tracks), but without
resetting st->codecpar, leading to double-frees lateron. This commit
therefore ignores said tag which makes rtp hint streams unremuxable.

This fixes tickets #8181 and #8186.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-04 23:38:43 +02:00
Andreas Rheinhardt
6770057ac9 avcodec/dvenc: Fix undefined left shift of negative numbers
The earlier code was based on the assumption that AVFrame.linesize can
not be negative.

Fixes ticket #8280.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-04 23:36:50 +02:00
Paul B Mahol
3a035a8cd2 avfilter/vf_v360: fix possible out of range values 2020-10-04 19:23:52 +02:00
Paul B Mahol
eaba6cecfb avfilter/vf_v360: add mitchell interpolation 2020-10-04 19:23:52 +02:00
Michael Niedermayer
acd735efaf avformat/moflex: Check m->size before seeking
Fixes: Infinite loop
Fixes: 26016/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6195663833137152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-04 16:54:11 +02:00
Michael Niedermayer
3291d994b7 avcodec/dxtory: Fix negative stride shift in dx2_decode_slice_420()
Fixes: left shift of negative value -640
Fixes: 26044/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXTORY_fuzzer-5631057602543616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-04 16:54:11 +02:00