summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/iamf_parse: Check sound_systemMichael Niedermayer2024-04-04
| | | | | | | | Fixes: index 13 out of bounds for type 'const struct IAMFSoundSystemMap [13]' Fixes: 67796/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-4554553191104512 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* configure: Separate subsystem for Immersive Audio ModelEugene Zemtsov2024-04-03
| | | | | | | | | | This change allows users to build libavfomat without support for Immersive Audio Model by specifying --disable-iamf. It helps to save on binary size in cases where it's important. Co-authored-by: James Almer <jamrial@gmail.com> Signed-off-by: Eugene Zemtsov <eugene@chromium.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/isom: don't drop the known layout when parsing AAC decSpecificInfoJames Almer2024-04-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/isom: Uninit layout in ff_mp4_read_dec_config_descr()Michael Niedermayer2024-04-02
| | | | | | | | | Fixes: memleak Fixes: 67442/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-5068813261406208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/rcwtenc: remove repeated documentationMarth642024-04-02
| | | | | | | | The high level summary of RCWT can be delegated doc/muxers, which makes it easier to maintain and more consistent with the documentation of the demuxer. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/rcwtenc: don't assume .bin extensionMarth642024-04-02
| | | | Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/rcwtdec: add RCWT Closed Captions demuxerMarth642024-04-02
| | | | | | | | | | | | | | | RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly used OSS tool for processing 608/708 Closed Captions (CC). RCWT can be used to archive the original extracted CC bitstream. The muxer was added in January 2024. In this commit, add the demuxer. One can now demux RCWT files for rendering in ccaption_dec or interop with ccextractor (which produces RCWT). Using the muxer/demuxer combo, the CC bits can be kept for processing or rendering with either tool. This can be an effective way to backup an original CC stream, including format extensions like EIA-708 and overall original presentation. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet ↵Marth642024-04-02
| | | | | | | | | | | | | | | | available events If ff_subtitles_queue_insert() were given a NULL buffer with 0 length, it would still attempt to grow the packet or memcpy depending on if merge option is enabled. In this commit, allow passing a NULL buffer with 0 length without attempting to do such operations. This way, if a subtitle demuxer happens to pass an empty cue or wants to use av_get_packet() to read bytes, there are no unnecessary operations on the packet after it is allocated. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/demux: add duration_probesize AVOptionNicolas Gaullier2024-04-02
| | | | | | | | | | | | | | | | | | | | | | | | Yet another probesize used to get the durations when estimate_timings_from_pts is required. It is aimed at users interested in better durations probing for itself, or because using avformat_find_stream_info indirectly and requiring exact values: for concatdec for example, especially if streamcopying above it. The current code is a performance trade-off that can fail to get video stream durations in a scenario with high bitrates and buffering for files ending cleanly (as opposed to live captures): the physical gap between the last video packet and the last audio packet is very high in such a case. Default behaviour is unchanged: 250k up to 250k << 6 (step by step). Setting this new option has two effects: - override the maximum probesize (currently 250k << 6) - reduce the number of steps to 1 instead of 6, this is to avoid detecting the audio "too early" and failing to reach a video packet. Even if a single audio stream duration is found but not the other audio/video stream durations, there will be a retry, so at the end the full user-overriden probesize will be used as expected by the user. Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
* avformat/mov: simplify the entry count overflow check in the keys atomJames Almer2024-04-02
| | | | | Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: don't read key_size bytes twice in the keys atomJames Almer2024-04-02
| | | | | | | We only support mdta as type, yet we were not skipping other types, but rather reading key_size worth of bytes twice per entry. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: take into account the first eight bytes in the keys atomJames Almer2024-04-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: Check if a key is longer than the atom containing itEugene Zemtsov2024-04-02
| | | | | | | | | Stop reading keys and return AVERROR_INVALIDDATA if key_size is larger than the amount of space left in the atom. Bug: https://crbug.com/41496983 Signed-off-by: Eugene Zemtsov <eugene@chromium.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: Don't add attached pic if one is already presentAndreas Rheinhardt2024-04-02
| | | | | | | | | | Fixes: memleak Fixes: 67714/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5671570999476224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: ensure all items id referenced by a grid are validJames Almer2024-04-01
| | | | | | | | | Fixes: null pointer dereference Fixes: 67494/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6528714521247744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Tested-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mpegts: Reset local nb_prg on add_program() failureMichael Niedermayer2024-04-01
| | | | | | | | | | | add_program() will deallocate the whole array on failure so we must clear nb_prgs Fixes: null pointer dereference Fixes: crash-35a3b39ddcc5babeeb005b7399a3a1217c8781bc Found-by: Catena cyber Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aiffdec: Check for previously set channelsMichael Niedermayer2024-04-01
| | | | | | | | Fixes: out of array access (av_channel_layout_copy()) Fixes: 67087/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-4920720268263424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Make edit_unit_byte_count unsignedMichael Niedermayer2024-04-01
| | | | | Suggested-by: Marton Balint <cus@passwd.hu> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/movenc: Check that cts fits in 32bitMichael Niedermayer2024-04-01
| | | | | | | | Fixes: Assertion av_rescale_rnd(start_dts, mov->movie_timescale, track->timescale, AV_ROUND_DOWN) <= 0 failed at libavformat/movenc.c:3694 Fixes: poc2 Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/iamf_parse: keep count_label consistent on language_label ↵James Almer2024-04-01
| | | | | | | | | | allocation failure Fixes: null pointer dereference Fixes: 67023/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6011025237278720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/iamf_reader: Check len before summingMichael Niedermayer2024-04-01
| | | | | | | | | Fixes: integer overflow Fixes: 67275/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5438920751906816 Fixes: 67688/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5970342318243840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Check first case of offset_temp computation for overflowMichael Niedermayer2024-04-01
| | | | | | | | | This is kind of ugly Fixes: signed integer overflow: 255 * 1157565362826411919 cannot be represented in type 'long' Fixes: 67313/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6250434245230592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/internal: Move avpriv_set_systematic_pal2 decl to imgutils_internal.hAndreas Rheinhardt2024-03-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-31
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lib*/version: Use static_assert for static assertsAndreas Rheinhardt2024-03-31
| | | | | | | Also update the checks that guard against inserting a new enum entry in the middle of a range. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "avformat/mov: ignore item boxes for animated heif"James Almer2024-03-30
| | | | | | | | This reverts commit f6b7b473d456a6aa1c063c4261b17277e2c70ac0. The image in the item boxes and the animation in the trak box are not necessarely the same, so both should be exported. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flac_picture: print a warning when mimetype is unknownJames Almer2024-03-28
| | | | | | | It's not an error since bba6df9ac7bd8386d92e1a7f5c737ca4e575fcc. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* Don't throw an error when attached picture isn't recognized.Dale Curtis2024-03-28
| | | | | | | | The MIME type field is required per the FLAC standard, but it's not an error just because ffmpeg doesn't recognize it. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* all: Don't use ATOMIC_VAR_INITAndreas Rheinhardt2024-03-28
| | | | | | | | | | | | | | | | | | | | C11 required to use ATOMIC_VAR_INIT to statically initialize atomic objects with static storage duration. Yet this macro was unsuitable for initializing structures [1] and was actually unneeded for all known implementations (this includes our compatibility fallback implementations which simply wrap the value in parentheses: #define ATOMIC_VAR_INIT(value) (value)). Therefore C17 deprecated the macro and C23 actually removed it [2]. Since commit 5ff0eb34d2b1089d3dd9f27fdb51520001709138 we default to C17 if the compiler supports it; Clang warns about ATOMIC_VAR_INIT in this mode. Given that no implementation ever needed this macro, this commit stops using it to avoid this warning. [1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_485 [2]: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: don't abort on duplicate Mastering Display Metadata boxesJames Almer2024-03-27
| | | | | | | | | | The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer <jamrial@gmail.com>
* Bump after 7.0 branch pointMichael Niedermayer2024-03-27
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump prior release/7.0 branchMichael Niedermayer2024-03-27
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/westwood_vqa: Fix 2g packetsMichael Niedermayer2024-03-26
| | | | | | | | Fixes: signed integer overflow: 2147483424 * 2 cannot be represented in type 'int' Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-4576211411795968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskadec: Check timescaleMichael Niedermayer2024-03-26
| | | | | | | | Fixes: 3.82046e+18 is outside the range of representable values of type 'unsigned int' Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6381436594421760 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wavdec: satuarte next_tag_ofs, data_endMichael Niedermayer2024-03-26
| | | | | | | | Fixes: signed integer overflow: 5053074104798691550 + 5053074104259715104 cannot be represented in type 'long' Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6515315309936640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wavdec: sanity check channels and bps before using them for block_alignMichael Niedermayer2024-03-26
| | | | | | | | Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-4704044498944000 Fixes: signed integer overflow: 520464 * 8224 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/sbgdec: Check for negative durationMichael Niedermayer2024-03-26
| | | | | | | | Fixes: signed integer overflow: 9223372036854775807 - -8000000 cannot be represented in type 'long' Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-5133181743136768 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/rpl: Use 64bit for total_audio_size and check itMichael Niedermayer2024-03-26
| | | | | | | | Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-4677434693517312 Fixes: signed integer overflow: 5555555555555555556 * 8 cannot be represented in type 'long long' 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: use 64bit for intermediate for roundingMichael Niedermayer2024-03-26
| | | | | | | | Fixes: signed integer overflow: 1768972133 + 968491058 cannot be represented in type 'int' Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4802790784303104 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/jacosubdec: Use 64bit for absMichael Niedermayer2024-03-26
| | | | | | | | Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5401294942371840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/concatdec: Check user_duration sumMichael Niedermayer2024-03-26
| | | | | | | | Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-6434245599690752 Fixes: signed integer overflow: 9223372026773000000 + 22337000000 cannot be represented in type 'long' 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: Do not deallocate heif_item in a input dependant wayMichael Niedermayer2024-03-26
| | | | | | | | | Fixes: out of array access Fixes: 67070/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5685384082161664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dvdvideodec: add explicit inttypes.h includeMarth642024-03-26
| | | | | | | | | | Since log statements printing int64 were made portable in 4464b7eeb194e98ac115f18d2b6be67361407c8a, let us include inttypes.h explicitly (as it is unclear where PRId64 and such are coming from now). Reported-by: Leo Izen <leo.izen@gmail.com> Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/mov: free HEIFItem.name when cleaning items in mov_read_trakJames Almer2024-03-26
| | | | | | Fixes memleaks. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.hAndreas Rheinhardt2024-03-26
| | | | | | | | | and rename it to FF_INFMT_INIT_CLEANUP. This flag is demuxer-only, so this is the more appropriate place for it. This does not preclude adding internal flags common to both demuxer and muxer in the future. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/vqf: Return 0 on success in read_packetAndreas Rheinhardt2024-03-26
| | | | | | Demuxers are not supposed to return the size of the packet read. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/cdg: Don't store avio_size() return value in intAndreas Rheinhardt2024-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/lafdec: Fix shadowingAndreas Rheinhardt2024-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/argo_cvg: Avoid relocations for ArgoCVGOverrideAndreas Rheinhardt2024-03-26
| | | | | | | | | | The average length of the strings used here does not differ much from the length of the longest string; therefore it makes sense to use an array big enough for the longest string and not a pointer to a string. This also moves this array into .rodata (from .data.rel.ro). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/wady: Combine skipsAndreas Rheinhardt2024-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>