summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/utils: change AVStream side data related public function and struct ↵James Almer2021-03-10
| | | | | | | | | size types to size_t av_stream_add_side_data() already defines size as a size_t, so this makes it consistent across all side data functions. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mvdec: Allocate extradata only onceMichael Niedermayer2021-03-09
| | | | | | | | Fixes: memleak Fixes: 28686/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5822961932173312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flvdec: Check double before cast in parse_keyframes_index()Michael Niedermayer2021-03-08
| | | | | | | | Fixes: -2.21166e+304 is outside the range of representable values of type 'long' Fixes: 29169/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5725452796821504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/paf: Check for EOF before allocation in read_header()Michael Niedermayer2021-03-08
| | | | | | | | Fixes: OOM Fixes: 26584/clusterfuzz-testcase-minimized-ffmpeg_dem_PAF_fuzzer-5172661183053824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/swfdec: Check outlen before allocationMichael Niedermayer2021-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: Timeout (too long -> 241ms) Fixes: 29083/clusterfuzz-testcase-minimized-ffmpeg_dem_SWF_fuzzer-6273684478230528 The source of the magic number is A very quick simulation of the best case compression for "compress" below is not nice written code as i did not expect I or anyone else would ever see it again I would have preferred some nicer expression or course, but thats what it seems to be asymptotically. For smaller amounts of data a tighter bound is possible but i saw no nice way to consider that and it seems also overkill to try to do it more fine grained for just this main(){ int64_t bits = 0; int bank = 256; int bitbank = 8; for(unsigned i = 0; i<1024*1024*1024*4U-100000;) { int word_size = bank-255; i += word_size; bits += bitbank; if (!(bank & (bank-1))) bitbank ++; bank++; if (bitbank > 16) { printf("BEST %f \n", 8.0 * i / bits ); bank = 256; bitbank = 8; } } } above assumes i remembered correctly how the algorithm works but the value was close to what actual compession of zeros gave Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mobiclip: fix copyright headersFlorian Nouwt2021-03-08
| | | | | | | | The Mobiclip related code was based on Mobius (https://github.com/adibsurani/Mobius), which was based on my original reverse engineering efforts (https://github.com/Gericom/MobiclipDecoder). This commit adds the appropriate copyright headers on the related files. Signed-off-by: Florian Nouwt <fnouwt2@gmail.com>
* avformat/dashdec: Don't needlessly strdup metadataAndreas Rheinhardt2021-03-08
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/dashdec: Remove limit on length of idAndreas Rheinhardt2021-03-08
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/http: Fix leak when using deprecated optionAndreas Rheinhardt2021-03-07
| | | | | | | | | | | | When the deprecated option "user-agent" was set to something different than its default value, said option would always precede and overwrite the ordinary user_agent option (regardless of whether it was explicitly set) which leads to a leak of the user_agent option (which has a default value, so the leak happens always). Fix this by setting the same destination for both options; the last option applied wins then. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: add TTML muxerJan Ekström2021-03-05
| | | | | | | | | | Enables writing TTML documents or encoded TTML paragraphs as such documents. Additionally, a test for the combined TTML encoder and muxer has been added to validate that the components still work. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/aadec: Replace strncpy by av_strlcpyAndreas Rheinhardt2021-03-05
| | | | | | | | | | | While this usage of strncpy is correct, said function nevertheless has the disadvantage of not automatically ensuring that the destination string is zero-terminated. So av_strlcpy should be preferred. This also removes a -Wstringop-truncation warning from GCC (it doesn't matter whether the buffer is truncated, as long as it can fit all the names of the supported codecs). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/aadec: Use smaller scope for variables, remove initializationsAndreas Rheinhardt2021-03-05
| | | | | | avio_get_str always zero terminates the strings it reads. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavf/sga: Silence several warnings because of wrong format specifiers.Carl Eugen Hoyos2021-03-04
| | | | | Fixes warnings like: warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument n has type ‘uint64_t’
* avformat/mxfdec: add support for getting product version number metadataMarton Balint2021-03-04
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: change toolkit_version metadata field to toolkit_version_numMarton Balint2021-03-04
| | | | | | | It only got added recently, and the new name makes it consistent with product_version_num in the next patch. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/lxfdec: Fix multiple integer overflows related to track_sizeMichael Niedermayer2021-03-03
| | | | | | | | Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_LXF_fuzzer-6634030636335104 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mccdec: Use av_sat_add64() for fsMichael Niedermayer2021-03-03
| | | | | | | | Fixes: signed integer overflow: -9223372036854775808 + -242 cannot be represented in type 'long' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_MCC_fuzzer-6723018395090944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mspdec: Check packet_size more completelyMichael Niedermayer2021-03-03
| | | | | | | | | | Fixes: OOM Fixes: 28348/clusterfuzz-testcase-minimized-ffmpeg_dem_MSP_fuzzer-4612055872831488 Fixes: 28360/clusterfuzz-testcase-minimized-ffmpeg_dem_MSP_fuzzer-6245230626078720 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>
* avformat/aiffdec: Check that SSND is at least 8 bytesMichael Niedermayer2021-03-03
| | | | | | | | | Fixes: Infinite loop Fixes: 30874/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-5933710488764416 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>
* avformat/dcstr: Check sample rateMichael Niedermayer2021-03-03
| | | | | | | | | Fixes: signed integer overflow: -1300248894420254720 * 16 cannot be represented in type 'long' Fixes: 30879/clusterfuzz-testcase-minimized-ffmpeg_dem_DCSTR_fuzzer-5094464215449600 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>
* avformat/frmdec: Simplify finding pixel formatAndreas Rheinhardt2021-03-03
| | | | | | | | | | | The fourccs used by the Megalux Frame format to determine the pixel format are actually no fourccs at all as they are a single byte. Furthermore, their range is continuous (1-5), so they are actually ordinary indices. So treat them as such and don't use PixelFormatTags for them. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: Deprecate AVFMT_FLAG_PRIV_OPT, remove av_demuxer_open on bumpAndreas Rheinhardt2021-03-03
| | | | | | | | | | | | | | | | | | | | | | | This flag was added in 492026209b9b58eaf6d2ea56423f6b1e1a8a76a5 in conjunction with av_demuxer_open() to allow to pass private options to demuxers. It worked as follows: av_open_input_stream() (the predecessor of avformat_open_input()) would not call the read_header function if this flag is set. Instead the user could set private options of the demuxer via the format's private class after avformat_open_input() and then call av_demuxer_open() which called the format's read_header function. This approach was abandoned in e37f161e66e042d6c2c7470c4d9881df9427fc4a and av_demuxer_open() deprecated; instead the AVDictionary based way of passing private options to the demuxer was choosen. Yet AVFMT_FLAG_PRIV_OPT has never been deprecated and av_demuxer_open() never removed. This commit implements the deprecation of the flag and schedules av_demuxer_open for removal on the next major bump. Given that av_demuxer_open() has been deprecated in 2012 and that this flag is useless without it, the flag will be ignored after the next major version bump. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* ivfenc: write duration for frame_cnt=1.Ronald S. Bultje2021-03-03
|
* avformat/dashdec: Increase size of id bufferAndreas Rheinhardt2021-03-02
| | | | | | | | The current size is not enough, see e.g. http://ftp.itec.aau.at/datasets/DASHDataset2014/TearsOfSteel/1sec/TearsOfSteel_1s_simple_2014_05_09.mpd Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/dashdec: Ensure strings are zero-terminatedAndreas Rheinhardt2021-03-02
| | | | | | | | | | | | | | | | | strncpy only ensures that one does not write beyond the end of the destination buffer; in case of truncation it does not zero-terminate the destination buffer. This makes using it the way it is now in the DASH demuxer dangerous. So use av_strlcpy instead. Also don't write anything if there is no id: The buffer has already been zeroed initially. The DASH testset from the Universität Klagenfurt contains samples with ids that are too long. E.g. http://ftp.itec.aau.at/datasets/DASHDataset2014/TearsOfSteel/1sec/TearsOfSteel_1s_simple_2014_05_09.mpd Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Add support for FlagOriginalAndreas Rheinhardt2021-03-02
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Add support for FlagOriginalAndreas Rheinhardt2021-03-02
| | | | | | | | | | | | | | | | Needs a CountedElement in order to distinguish the case of the element not being present and the element being present with a value of zero. (It has been argued by Ridley Combs that one should only ever use the AV_DISPOSITION_DUB field for audio tracks. Yet given that there is no definition for the disposition flags, one can also interpret it to mean that e.g. a subtitle track is meant to be used with the dubbed audio track or the original audio track. This commit interprets this flag in this sense, which also allows to maintain it on remuxing.) Reviewed-by: Anton Khirnov <anton@khirnov.net> Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mov: Extend data_size check in mov_read_udta_string()Michael Niedermayer2021-03-01
| | | | | | | | Fixes: signed integer overflow: -2147483634 - 16 cannot be represented in type 'int' Fixes: 28322/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5711888402612224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aadec: Check for EOF while reading chaptersMichael Niedermayer2021-03-01
| | | | | | | | Fixes: timeout Fixes: 28199/clusterfuzz-testcase-minimized-ffmpeg_dem_AA_fuzzer-4896162657861632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/voc_packet: Add a basic check on max_sizeMichael Niedermayer2021-03-01
| | | | | | | | Fixes: signed integer overflow: -2147483648 - 4 cannot be represented in type 'int' Fixes: 28127/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-4880586455646208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/sga: improve probing for valid filesPaul B Mahol2021-03-01
| | | | Update variables depending on high four bits of first two bytes.
* avformat: add Digital Pictures SGA game demuxerPaul B Mahol2021-03-01
|
* Remove double ';'Andreas Rheinhardt2021-03-01
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/avio: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids calculating the length in advance. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/pcmdec: Beautify pcm_read_headerAndreas Rheinhardt2021-02-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/pcmdec: Simplify parsing MIME typeAndreas Rheinhardt2021-02-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/pcmdec: Fix NULL + 1Andreas Rheinhardt2021-02-28
| | | | | | It is undefined behaviour. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/pcm(dec|enc): Don't include disabled (de)muxersAndreas Rheinhardt2021-02-28
| | | | | | | | Also make the macro used for the demuxers spec-compliant. The earlier macro was not, because the ... argument of a variadic macro must not be left out. GCC and Clang warn about this when using -pedantic. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/movenc: Only check for timecodes if they are usedAndreas Rheinhardt2021-02-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/movenc: Don't check for disabled muxersAndreas Rheinhardt2021-02-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/movenc: Remove always true checkAndreas Rheinhardt2021-02-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/movenccenc: Fix memory leak for muxing CENC-encrypted filesVadym Bezdushnyi2021-02-27
| | | | | | | | | | | | | | | | | | | | | | | | Memory for auxillary_info was not freed after usage. Leak can be reproduced with following commands: Optionally, generate input video: ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 input.mp4 Run ffmpeg with valgrind: valgrind --leak-check=full --show-leak-kinds=all \ ffmpeg -y -i input.mp4 -vcodec copy -acodec copy \ -encryption_scheme cenc-aes-ctr \ -encryption_key 00000000000000000000000000000000 \ -encryption_kid 00000000000000000000000000000000 \ ffmpeg_encrypted.mp4 For test video which has duration of 10 sec, leak is 4 Kb. For 100 sec video, leak will be 33 Kb. Most likely, leaked memory will grow linearly to the number of input frames. Signed-off-by: Vadym Bezdushnyi <vadim.bezdush@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/matroskadec: Add webm file extensionAndreas Rheinhardt2021-02-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/concat: Remove unnecessary checkAndreas Rheinhardt2021-02-27
| | | | | | | | | This code was written when the allocation functions used parameters of type unsigned. This is no longer true today and therefore we only need to check whether the multiplication of the array's size stays within a size_t -- and this can be offloaded to av_realloc_array. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/spdifenc: Fix leak upon errorAndreas Rheinhardt2021-02-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/wavenc: Fix leak and segfault on reallocation errorAndreas Rheinhardt2021-02-27
| | | | | | | | | | | | | | | | | | | | | Up until now, the wav muxer used a reallocation of the form ptr = av_realloc(ptr, size); that leaks upon error. Furthermore, if a failed reallocation happened when writing the trailer, a segfault would occur due to avio_write(NULL, size) because the muxer only prints an error message upon allocation error, but does not return the error. Moreover setting the pointer to the buffer to NULL on error seems to be done on purpose in order to record that an error has occured so that outputting the peak values is no longer attempted. This behaviour has been retained by simply disabling whether peak data should be written if an error occurs. Finally, the reallocation is now done once per peak block and not once per peak block per channel; it is also done with av_fast_realloc and not with a linear size increase. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/imx: set video stream durationPaul B Mahol2021-02-25
|
* avcodec/imx: use ff_reget_buffer()Paul B Mahol2021-02-25
| | | | | Also flush internal stuff upon seeking. This codec is not intra only.