summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/4xm: Check for duplicate track idsMichael Niedermayer2021-12-16
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/4xm: Consider max_streams on reallocating tracks arrayMichael Niedermayer2021-12-16
| | | | | | | | Fixes: OOM Fixes: 41595/clusterfuzz-testcase-minimized-ffmpeg_dem_FOURXM_fuzzer-6355979363549184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/cinedec: Avoid repeatedly allocating packets beyond the inputMichael Niedermayer2021-12-16
| | | | | | | | Fixes: Timeout Fixes: 41025/clusterfuzz-testcase-minimized-ffmpeg_dem_CINE_fuzzer-5540848285122560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Check next offset in mov_read_dref()Michael Niedermayer2021-12-16
| | | | | | | | Fixes: signed integer overflow: 9223372036200463215 + 1109914409 cannot be represented in type 'long' Fixes: 41480/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6553086177443840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vivo: Favor setting fps from explicit fractionsMichael Niedermayer2021-12-16
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vivo: Do not use the general expression evaluator for parsing a ↵Michael Niedermayer2021-12-16
| | | | | | | | | | floating point value Fixes: Timeout Fixes: 41564/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVO_fuzzer-6309014024093696 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mvdec: Use 64 bit in timestamp computationMichael Niedermayer2021-12-16
| | | | | | | | | | Fixes: division by zero Fixes: 42198/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5054366405492736.fuzz Fixes: 42222/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4561249331970048 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aviobuf: fix double free by return early on errorSteven Liu2021-12-16
| | | | | | | | | | Because the s->buffer has been freed by av_freep in avio_closep. It should not av_freep the buffer in label fail after avio_closep. Then just move the av_freep before avio_closep and remove the label fail. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Reviewed-by: Zhao Zhili <zhilizhao@tencent.com> Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/moflex: Don't use uninitialized timebase for data streamAndreas Rheinhardt2021-12-16
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/moflex: Free AVPackets via av_packet_free() on errorAndreas Rheinhardt2021-12-16
| | | | | | | (This is not a leak as long as av_free() completely frees blank packets.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Remove redundant prevention against infinite loopAndreas Rheinhardt2021-12-16
| | | | | | | | | | | | | | | | | | | This piece of code has been added as FFmpeg's answer to infinite loops in try_decode_frame() in commit 6072a19b4f311cb172d45e90daad90824e40e4b6. There is no loop around try_decode_frame() any more, so this code can be removed. This code is only triggered in case a) the codec parameter could not be determined, b) the decode delay could not be guessed or c) no packet was ever encountered and the encoder has the AV_CODEC_CAP_CHANNEL_CONF. In these cases the new code will no longer emit a "decoding for stream %d failed" message, which is prima facie false. In case a) an additional "Could not find codec parameters" message is (and will be) emitted. No warning will be emitted any more in case b) (this happens e.g. with some h264-conformance FATE-files). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Remove fake-loopAndreas Rheinhardt2021-12-16
| | | | | | | When flushing, try_decode_frame() itself loops until the desired properties have been found or the decoder is drained. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rtpdec_rfc4175: cosmetic changesLimin Wang2021-12-14
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: deprecate hls_ts_options optionSteven Liu2021-12-13
| | | | | | | Because the hls_ts_options will be misunderstand by user, and then user can use hls_segment_options instead of hls_ts_options. Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/hlsenc: add hls_segment_options correct the segment options nameSteven Liu2021-12-13
| | | | | | | Because the hls_ts_options will be misunderstand by user that only can be used in mpegts segments option. So add this option for segments. Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/img2enc: do not ignore IO errorsMarton Balint2021-12-12
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: introduce AVFormatContext io_close2 which returns an intMarton Balint2021-12-12
| | | | | | | | | | | | | | | | | Otherwise there is no way to detect an error returned by avio_close() because ff_format_io_close cannot get the return value. Checking the return value of the close function is important in order to check if all data was successfully written and the underlying close() operation was successful. It can also be useful even for read mode because it can return any pending AVIOContext error, so the user don't have to manually check AVIOContext->error. In order to still support if the user overrides io_close, the generic code only uses io_close2 if io_close is either NULL or the default io_close callback. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/aviobuf: return stored AVIO context error on avio_closeMarton Balint2021-12-12
| | | | | | Otherwise IO errors at avio_flush() before closing may be lost. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/file: use proper return value in file_closeMarton Balint2021-12-12
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: Check for duplicate mxf_read_index_entry_array()Michael Niedermayer2021-12-09
| | | | | | | | | Fixes: memleak Fixes: 41596/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6439060204290048 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Check component_depth in mxf_get_color_range()Michael Niedermayer2021-12-09
| | | | | | | | | Fixes: shift exponent 4294967163 is too large for 32-bit type 'int' Fixes: 41449/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6183636217495552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Add const where appropriateAndreas Rheinhardt2021-12-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Fix wrong indentationAndreas Rheinhardt2021-12-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Simplify data->hex conversionAndreas Rheinhardt2021-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/md5proto: Simplify data->hex conversionAndreas Rheinhardt2021-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Use smaller scope for variablesAndreas Rheinhardt2021-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Simplify data->hex conversionAndreas Rheinhardt2021-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Simplify deriving file keyAndreas Rheinhardt2021-12-08
| | | | | | | | Don't use different src and dst in av_tea_crypt(); use in-place modifications instead. Also let av_tea_crypt() encrypt all three blocks in one call. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Don't unnecessarily reinitialize AVTEA contextAndreas Rheinhardt2021-12-08
| | | | | | | | We use ECB, not CBC mode here, so one does not need to reinitialize the context; for the same reason, one can also just let av_tea_crypt() loop over the blocks, avoiding a loop here. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Avoid copying data aroundAndreas Rheinhardt2021-12-08
| | | | | | | | | | | | | Up until now, the packets have been read in blocks of at most eight bytes at a time; then these blocks have been decrypted and copied into a buffer on the stack (that was double the size needed...). From there they have been copied to the dst packet. This commit changes this: The data is read in one go; and the decryption avoids temporary buffers, too, by making use of the fact that src and dst of av_tea_crypt() can coincide. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Don't use the same loop counter in inner and outer loopAndreas Rheinhardt2021-12-08
| | | | | | | Due to this bush.aa (from the FATE suite) exported garbage metadata with key "_040930". Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Make ff_data_to_hex() zero-terminate the stringAndreas Rheinhardt2021-12-08
| | | | | | Most callers want it that way anyway. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rtsp: fix the error code from ffurl_read_complete()Limin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: add error code handling for ff_rtsp_skip_packet()Limin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: free the alloc memory if failedLimin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: remove redundant assignmentLimin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/concatf: ignore trailing whitespacesGyan Doshi2021-12-07
| | | | | | | | The concatf protocol returns an opaque error on open if concatf list file contains trailing newlines. Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro> Reviewed-by: James Almer <jamrial@gmail.com>
* lavf/protocols: avoid discarding const in avio_enum_protocols()Anton Khirnov2021-12-07
| | | | | | Instead of storing the protocol pointer in the opaque iteration state, store just the index of the next protocol, similarly to how ff_urlcontext_child_class_iterate() works.
* lavf/img2enc: avoid a useless copy of the urlAnton Khirnov2021-12-07
| | | | | img2enc keeps a private (and possibly truncated) copy of the url that is never modified. Just use AVFormatContext.url instead.
* lavf/ftp: check for truncation in snprintfAnton Khirnov2021-12-07
| | | | | | | | | | | Silences e.g. the following warning in gcc 10: src/libavformat/ftp.c: In function ‘ftp_move’: src/libavformat/ftp.c:1122:46: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4091 [-Wformat-truncation=] 1122 | snprintf(command, sizeof(command), "RNTO %s\r\n", path); | ^~ ~~~~ src/libavformat/ftp.c:1122:5: note: ‘snprintf’ output between 8 and 4103 bytes into a destination of size 4096 1122 | snprintf(command, sizeof(command), "RNTO %s\r\n", path); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* avformat/mov: Disallow duplicate smdmMichael Niedermayer2021-12-06
| | | | | | | | Fixes: memleak Fixes: 39879/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5327819907923968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Check for EOF in mov_read_glbl()Michael Niedermayer2021-12-06
| | | | | | | | Fixes: Infinite loop Fixes: 41351/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5433895854669824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/smoothstreamingenc: Move buffers to the end of structsAndreas Rheinhardt2021-12-05
| | | | | | | | This reduces codesize because the offsets of commonly used elements are now smaller and thus need less bytes to encode in ptr+offset addressing modes (with GCC 11.2 on x64: 0x1b8b -> 0x1a7b). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/takdec: Simplify data->hex conversionAndreas Rheinhardt2021-12-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: do not use AVIO_FLAG_* with avio_alloc_contextMarvin Scholz2021-12-04
| | | | | | | | | | | | | The documentation states that here 0 should be used for read-only and 1 for a writable buffer. AVIO_FLAG_WRITE however is 2, while it works due to the way the flag is handled internally, it is still wrong according to the documentation. Additionally it makes it seem as if the AVIO_FLAG_* values could be used here, which is actually not true, as when AVIO_FLAG_READ would be used here it would create a writable buffer as AVIO_FLAG_READ is defined as 1. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/rtspdec: get rid of the hardcoded max size for sdpLimin Wang2021-12-04
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: load the sdp file with avio_read_to_bprint()Limin Wang2021-12-04
| | | | | | | this allows getting rid of the hardcoded max size of SDP. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/aviobuf: check if read_packet() exist before read_packet_wrapper()Limin Wang2021-12-04
| | | | | | | without it, read_packet_wrapper() will return AVERROR(EINVAL) and avio_read will be failed. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* all: Use av_memdup() where appropriateAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mvdec: handle audio sample sizeJohn-Paul Stewart2021-12-03
| | | | | | | Adds support for reading audio sample size from the data instead of assuming all audio is 16 bits per sample. Reviewed-by: Peter Ross <pross@xvid.org>