Commit Graph

25505 Commits

Author SHA1 Message Date
Anton Khirnov de85815bfa lavf/mux: do not apply max_interleave_delta to subtitles
It is common for subtitle streams to have large gaps between packets.
When the caller is interleaving packets from multiple files, it can
easily happen that two successive subtitle packets trigger this limit,
even though no excessive buffering is happening.

Should fix #7064
2023-11-14 18:18:26 +01:00
Dave Johansen ab78d22553 avformat/hlsenc: Fix name of flag in error message
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2023-11-12 16:47:40 +08:00
Dave Johansen 39878fc504 avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-11-12 16:44:47 +08:00
Léon Spaans 9bcbe04aa0 avformat/hlsenc: set HTTP options before writing WebVTT HLS playlists
Fixes: Erroneous HTTP POST instead of HTTP PUT for WebVTT HLS variant playlists.

Signed-off-by: Léon Spaans <leons@gridpoint.nl>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-11-12 11:19:31 +08:00
Michael Niedermayer 19fcf43131
avformat/mov: Disallow FTYP after streams
Fixes: Assertion !c->fc->nb_streams failed at libavformat/mov.c:7799
Fixes: 63875/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5479178702815232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-10 00:14:02 +01:00
Peter Ross 10869cd849 avcodec: LEAD MCMP decoder
Partially fixes ticket #798

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Peter Ross <pross@xvid.org>
2023-11-08 17:37:58 +11:00
Anton Khirnov ad3df6bf35 lavf/smacker: export sample_aspect_ratio
Partially fixes #10617
2023-11-05 11:30:13 +01:00
Michael Niedermayer 4fb9d94688
avformat/lafdec: Check for 0 parameters
Fixes: Timeout
Fixes: 63661/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-6615365234589696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-03 22:16:33 +01:00
Andreas Rheinhardt 155f0c8ef7 avformat/webpenc: Check seeks
Addresses the issue reported in ticket #4609.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-03 14:47:57 +01:00
Michael Niedermayer 98c2711b58
avformat/mov: Check that is_still_picture_avif has no trak based streams
Fixes: Assertion failure in mov_read_iloc( in mov_read_iloc())
Fixes: 62866/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5282997370486784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:20 +01:00
Niklas Haas 6aff17a451 avformat/vf_vapoursynth: simplify xyz format check 2023-10-31 15:46:38 +01:00
Michael Niedermayer 47e784f881
Bump versions after 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer 9d3a7d30c4
Bump versions prior to 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 15:34:05 +01:00
Michael Niedermayer e4d5ac8d7d
avformat/rtsp: Use rtsp_st->stream_index
Fixes: out of array access
Fixes: rtpdec_h264.c149/poc

Found-by: Hardik Shah of Vehere
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:47 +02:00
James Almer 3c5bceb751 avformat/options: add missing disposition flag to AVStream class options
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-25 09:28:14 -03:00
Michael Niedermayer 70f5fa6325
avformat/mxfdec: Check klv offset
Fixes: Assertion klv_offset >= mxf->run_in failed at libavformat/mxfdec.c:736
Fixes: 62936/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5778404366221312.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:44:56 +02:00
Michael Niedermayer fff875a7f4
avformat/usmdec: do not return 0 when no packet was produced
Fixes: Assertion pkt->stream_index < (unsigned)s->nb_streams && "Invalid stream index.\n" failed at libavformat/demux.c:617
Fixes: 62498/clusterfuzz-testcase-minimized-ffmpeg_dem_USM_fuzzer-4734740995112960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:09:09 +02:00
Michael Niedermayer b79fc70596
avformat/tmv: Check video chunk size
This check matches the audio chunk check

Fixes: Timeout
Fixes: 62681/clusterfuzz-testcase-minimized-ffmpeg_dem_TMV_fuzzer-5299107876700160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-15 18:54:37 +02:00
Andreas Rheinhardt 37b5f4a1f6 avformat/matroskadec, mov: Fix declaration-after-statement warnings
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 00:21:43 +02:00
Michael Niedermayer cedb4736f5
avformat/asfdec_f: Saturate presentation time in marker
Fixes: signed integer overflow: -9223372036315799520 - 3873890816 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5009302746431488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:08 +02:00
Michael Niedermayer fe6ce28d11
avformat/xwma: sanity check bits_per_coded_sample
Fixes: signed integer overflow: 65312 * 524296 cannot be represented in type 'int'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_XWMA_fuzzer-6595971445555200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:07 +02:00
Michael Niedermayer 2d6df3719d
avformat/matroskadec: Check prebuffered_ns for overflow
Fixes: signed integer overflow: 9223372036630775808 + 1000000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-5406131992526848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:06 +02:00
Michael Niedermayer 929ddef3f4
avformat/wavdec: Check left avio_tell for overflow
Fixes: signed integer overflow: 155 + 9223372036854775655 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5364032278495232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:05 +02:00
Michael Niedermayer 5f0d00464a
avformat/tta: Better totalframes check
Fixes: signed integer overflow: 4 * 740491135 cannot be represented in type 'int'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_TTA_fuzzer-6298893367508992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:04 +02:00
Michael Niedermayer b3c973acbe
avformat/rpl: Check for number_of_chunks overflow
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int32_t' (aka 'int')
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-6086131095830528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:02 +02:00
Michael Niedermayer 3508b496e1
avformat/mov: compute absolute dts difference without overflow in mov_find_next_sample()
Fixes: signed integer overflow: -9223372036854775808 - 9222726413022000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5959420033761280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:01 +02:00
Michael Niedermayer 51f0ab8b12
avformat/jacosubdec: Check timeres
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:00 +02:00
Michael Niedermayer 32447b149f
avformat/jacosubdec: avoid signed integer overflows in get_shift()
Fixes: signed integer overflow: 22014562800 * 934633746 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5189603246866432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:35:59 +02:00
Michael Niedermayer 6490b9aed6
avformat/jacosubdec: Factorize code in get_shift() a bit
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:34:55 +02:00
Vignesh Venkatasubramanian via ffmpeg-devel 9132a0fbe2
avformat/mov: Disallow more than one meta box for AVIF
This is not allowed per the spec.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 18:56:34 +02:00
Michael Niedermayer 9b00b5734d
avformat/sbgdec: Check for negative duration or un-representable end pts
Fixes: signed integer overflow: 9230955872951340 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6330481893572608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 18:56:27 +02:00
Paul B Mahol 71716406e6 avformat/wavdec: w64: do not error out for broken files if data start is found
Also attempt to fix invalid block_align value.
2023-10-07 11:19:54 +02:00
James Almer 5432d2aaca avformat/avformat: use the side data from AVStream.codecpar
Deprecate AVStream.side_data and its helpers in favor of the AVStream's
codecpar.coded_side_data.

This will considerably simplify the propagation of global side data to decoders
and from encoders. Instead of having to do it inside packets, it will be
available during init().
Global and frame specific side data will therefore be distinct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:03:57 -03:00
Michael Niedermayer 52d666edec
avformat/avs: Check if return code is representable
Fixes: leak
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 5c0df3da0b
avformat/westwood_vqa: Check chunk size
the type is also changed to int as it is interpreted as int in av_get_packet()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-6593408795279360
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-4613908817903616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer a9137110ed
avformat/sbgdec: Check for period overflow
Fixes: signed integer overflow: 4481246996173000000 - -4778576820000000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-5063670588899328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:51 +02:00
Michael Niedermayer dedc78b4b5
avformat/concatdec: Check in/outpoint for overflow
Fixes: signed integer overflow: 91542414454000000 - -9154241494546000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Anton Khirnov 3562993d82 lavf/gifdec: do not mark as notimestamps
The demuxer does not set packet timestamps itself after
c6b6356635 and instead relies on the
parser to do it. However, this does not matter from the caller
perspective as it still happens inside the demuxer. The demuxer should
thus not be flagged as not having timestamps.
2023-10-03 16:57:02 +02:00
Anton Khirnov 80401b86d3 lavf/demux: restrict video parser duration handling to just GIF
The parser does not have a timebase associated with it, so in general it
makes no sense for it to be exporting durations. Longer-term this
should be handled more cleanly with a new parser API.
2023-10-03 16:57:02 +02:00
Andreas Rheinhardt dd48e49d54 avformat/avformat: Deprecate AVFMT_ALLOW_FLUSH
It is of no value to the user, because every muxer can always
be flushed with a NULL packet. As its documentation shows
("If not set, the muxer will not receive a NULL packet in
the write_packet function") it is actually an internal flag
that has been publically exposed because there was no internal
flags field for output formats for a long time. But now there is
and so use it by replacing the public flag with a private one.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 01:45:46 +02:00
Andreas Rheinhardt 259e1d2bd7 avformat/matroskaenc: Write default duration for audio
This is easily possible for those codecs with a fixed frame-size
(in samples).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:22:20 +02:00
Andreas Rheinhardt 0c1103d4dc avformat/matroskaenc: Don't create wrong packet durations
We have to write an explicit BlockDuration element (and use
a BlockGroup instead of a SimpleBlock) in case the Track
has a DefaultDuration that is inconsistent with the duration
of the packet.

The matroska-h264-remux test uses a file with coded fields
where the duration of a Block is the duration of a field,
not of a frame, therefore this patch writes said BlockDuration
elements.

(When using a BlockGroup, one has to add ReferenceBlock elements
to distinguish keyframes from non-keyframes. Unfortunately,
the AV1 codec mapping [1] requires us to reference all references
and to really use the real references, which requires a lot of
effort for basically no gain. When BlockGroups are used with AV1,
the created files are most likely invalid, both before and after
this patch, but this patch makes this more likely to happen.)

[1]: https://github.com/ietf-wg-cellar/matroska-specification/blob/master/codec/av1.md

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:22:05 +02:00
Paul B Mahol 9e531370b3 avformat/aea: fix bitrate for mono 2023-10-02 01:28:14 +02:00
Paul B Mahol edb6d6d536 avformat/aea: improve probe function 2023-10-02 01:28:11 +02:00
Michael Niedermayer 9a3bbf89bd
avformat/mov: Check avif_info
Fixes: leak
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6674082962997248
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6674082962997248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-29 23:08:38 +02:00
Michael Niedermayer 442d9412d2
avformat/mxfdec: Remove this_partition
Suggested-by: Tomas Härdin <git@haerdin.se>
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5130394286817280

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-29 19:23:36 +02:00
Paul B Mahol 8623067e8d avformat/isom_tags: add missing CFHD tag 2023-09-29 18:40:52 +02:00
Paul B Mahol eaffbd9ac4 avcodec/magicyuv: add 14bit rgb(a) support 2023-09-28 19:37:58 +02:00
Paul B Mahol 29b673bdcf swscale: add GBRAP14 format support 2023-09-28 19:37:58 +02:00
Michael Niedermayer 3aff8503a9
avformat/mov: Avoid cloning encryption info if its unchanged
Fixes: OOM
Fixes: 45834/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5419540462305280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-22 23:47:39 +02:00