summaryrefslogtreecommitdiff
path: root/libavformat/flvdec.c
Commit message (Collapse)AuthorAge
* avformat: Remove unnecessary inclusions from libavcodecAndreas Rheinhardt2022-03-23
| | | | | | Also improve the other headers a bit while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* flv: convert to new channel layout APIVittorio Giovara2022-03-15
| | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flvdec: timestamps cannot use the full int64 rangeMichael Niedermayer2021-12-30
| | | | | | | | | We do not support this as we multiply by 1000 Fixes: signed integer overflow: -45318575073853696 * 1000 cannot be represented in type 'long' Fixes: 42804/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-4630325425209344 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/flvdec: Deduplicate AVClassesAndreas Rheinhardt2021-07-08
| | | | | | | | The child_class_next API relied on different (de)muxers to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/flvdec: Check data before castingMichael Niedermayer2021-06-12
| | | | | | | | | Fixes: -nan is outside the range of representable values of type 'long' Fixes: signed integer overflow: 1000 * -9223372036854775808 cannot be represented in type 'long' Fixes: 34890/clusterfuzz-testcase-minimized-ffmpeg_dem_FLV_fuzzer-5334208657620992 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: use milisecond precision for parsing timestampsMarton Balint2021-05-20
| | | | | | | Also use helper function to set the timestamp. Maybe we could also use nanosecond precision, but there were some float rounding concerns. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/flvdec: normalize exporting date metadataAnton Khirnov2021-05-12
| | | | | | | | | | | | | Export them in UTC, not the local timezone. This way the output is the same everywhere. The timezone information stored in the file is still ignored, since there seems to be no simple way to export it correctly. Format them according to ISO 8601, which we generally use for exporting dates. Fixes fate-flv-demux, which was broken since 958bea5248f87116b0dd080461aa70c14ea86cf0 on some platforms.
* avformat: move AVStream.{parser,need_parsing} to AVStreamInternalJames Almer2021-05-07
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flvdec: Check array entry numberMichael Niedermayer2021-03-28
| | | | | | | | Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' Fixes: 30209/clusterfuzz-testcase-minimized-ffmpeg_dem_FLV_fuzzer-5724831658147840 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/flvdec: Treat high ts byte as unsignedMichael Niedermayer2021-02-10
| | | | | | | Fixes: left shift of 255 by 24 places cannot be represented in type 'int' Fixes: 27516/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5152854660349952 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flvdec: Check for EOF in amf_skip_tag()Michael Niedermayer2021-01-29
| | | | | | | | Fixes: Timeout Fixes: 29070/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5650106766458880 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 for avio_read() failure in amf_get_string()Michael Niedermayer2021-01-26
| | | | | Suggested-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flvdec: Check for nesting depth in amf_skip_tag()Michael Niedermayer2021-01-26
| | | | | | | | Fixes: out of array access Fixes: 29440/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5985279812960256.fuzz 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 for nesting depth in amf_parse_object()Michael Niedermayer2021-01-26
| | | | | | | | Fixes: out of array access Fixes: 29202/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5112845840809984 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: Use av_sat_add64() for pts computationMichael Niedermayer2021-01-23
| | | | | | | | Fixes: signed integer overflow: -9223372036854767583 + -65536 cannot be represented in type 'long' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_FLV_fuzzer-6734549467922432 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: move AVStream.*index_entries* to AVStreamInternalAnton Khirnov2020-10-28
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Since there are some (semi-)public fields located after these, even though this section is supposed to be private, keep some dummy padding there until the next major bump to preserve ABI compatibility.
* avformat/flvdec: Check for EOF in amf_parse_object()Michael Niedermayer2020-10-17
| | | | | | | | Fixes: Timeout (too long -> 1ms) Fixes: 26108/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5653887668977664 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: RtmpSampleAccess no longer breaks stream detectionPeter van der Spek2020-09-23
| | | | | | | | | | | | | | | | | Since release 4.2, FFmpeg fails to detect the correct streams in an RTMP stream that contains a |RtmpSampleAccess AMF object prior to the onMetaData AMF object. In the debug log it would show "[flv] Unknown type |RtmpSampleAccess". This functionality broke in commit d7638d8dfc3c4ffd0dc18a64937a5a07ed67b354 as unknown metadata packets now result in an opaque data stream, and the |RtmpSampleAccess packet was an "unknown" metadata packet type. With this change the RTMP streams are correctly detected when there is a |RtmpSampleAccess object prior to the onMetaData object. Signed-off-by: Peter van der Spek <p.vanderspek@bluebillywig.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flvdec: CosmeticsAndreas Rheinhardt2020-06-22
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/flvdec: Avoid duplicating extradata when adding side-dataAndreas Rheinhardt2020-05-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: Don't free old extradata before ff_alloc/get_extradataAndreas Rheinhardt2019-12-12
| | | | | | | | These functions already free it themselves before they allocate the new extradata. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: Forward errors where possibleAndreas Rheinhardt2019-12-12
| | | | | | | | | | It is not uncommon to find code where the caller thinks to know better what the return value should be than the callee. E.g. something like "if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit changes several instances of this to instead forward the actual error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flvdec: delete unused codeleozhang2019-08-23
| | | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: leozhang <leozhang@qiyi.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/flvdec: added support for KUX containerSwaraj Hota2019-04-06
| | | | | | | | Fixes ticket #4519. The metadata starting at 0xe00004 is encrypted with the password "meta" but zlib does not support decryption, so no kux metadata is read.
* lavf/flvdec: Cosmetics: Fix indentation for flv_read_packetJun Zhao2019-03-31
| | | | | | Commit e34ba5ec53b missed the indent Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavf/flvdec: add AMF date type supportJun Zhao2019-03-31
| | | | | | Support AMF date type when parse the FLV metadata. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavf/flvdec: fix typo in log messageJun Zhao2019-03-23
| | | | | | fix typo in log message, it's come from cd141e71bd3 Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-21
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* avformat/flvdec: Try to support some concatenated flv filesMichael Niedermayer2019-01-31
| | | | | | Fixes: discont.flv Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* flvdec: Export unknown metadata packets as opaque dataMartin Storsjö2018-11-05
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* flvdec: Rename FLV_STREAM_TYPE_DATA into FLV_STREAM_TYPE_SUBTITLEMartin Storsjö2018-11-05
| | | | | | This is always treated as a subtitle at the moment anyway. Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/flvdec: don't propagate empty extradataJames Almer2018-08-24
| | | | | | | Fixes ticket #7379 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flvdec: add flv_full_metadata option into flvdecSteven Liu2018-08-07
| | | | | | output all the metadata context when use this option. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/flvdec: reindent code for previous commitSteven Liu2018-08-07
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/flvdec: add flv_ignore_prevtag option into flvdecSteven Liu2018-08-07
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* lavf/flvdec: Remove an outdated comment.Carl Eugen Hoyos2018-07-25
| | | | The buffer size was increased in b2fecce3 to prepare for 790a3cdf.
* avformat/flvdec: Set broken_sizes for FlixEngine.Nikolas Bowe2018-02-23
| | | | | | | | | | | | | | | we found some very old videos which suffered from corruption after 9e6a2427558a718be0c1fffacffd935f630a7a8d, but were fine before. These had "End of AC stream reached in vp6_parse_coeff" warnings in logs. These also had flv Packet mismatch warnings. Adding FlixEngine to the list of flv muxers which produce broken packet sizes fixes this corruption. FlixEngine is very old and not maintained or available anymore (since 2010), so we won't need to worry about newer versions fixing the issue. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f'James Almer2017-10-28
|\ | | | | | | | | | | | | * commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f': flv: Validate the packet size Merged-by: James Almer <jamrial@gmail.com>
| * flv: Validate the packet sizeLuca Barbato2017-04-20
| | | | | | | | | | | | | | Size can be negative at that point. Bug-Id: 1041 CC: libav-stable@libav.org
| * flvdec: Set avg_frame_rate for video streamsCarl Eugen Hoyos2017-03-22
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | flvdec: Check the avio_seek return value after reading a metadata packetMartin Storsjö2017-10-27
| | | | | | | | | | | | | | | | | | | | | | | | merge from libav: 585dc1aecef0371ad6f16cb3750ae2a6da9cf00a If the metadata packet is corrupted, flv_read_metabody can accidentally read past the start of the next packet. If the start of the next packet had been flushed out of the IO buffer, we would be unable to seek to the right position (on a nonseekable stream). Prefer to clearly error out instead of silently trying to read from a desynced stream which will only be interpreted as garbage.
* | Revert "flvdec: Check the avio_seek return value after reading a metadata ↵Steven Liu2017-10-27
| | | | | | | | | | | | packet" This reverts commit ef7fe81b8554a2865d47a55edf47420878fa3d91.
* | flvdec: Check the avio_seek return value after reading a metadata packetSteven Liu2017-09-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | merge from libav: 585dc1aecef0371ad6f16cb3750ae2a6da9cf00a If the metadata packet is corrupted, flv_read_metabody can accidentally read past the start of the next packet. If the start of the next packet had been flushed out of the IO buffer, we would be unable to seek to the right position (on a nonseekable stream). Prefer to clearly error out instead of silently trying to read from a desynced stream which will only be interpreted as garbage. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* | avformat/flvdec: Set need_context_update when setting the initial extradataAlex Converse2017-09-03
| | | | | | | | | | | | Fixes ticket 6398. Debugged with the help of James Almer and Hendrik Leppkes.
* | avformat/flvdec: check FLVHeader PreviousTagSize0Steven Liu2017-03-28
| | | | | | | | | | | | | | | | | | | | | | | | refer to SPEC: Annex E. The FLV File Format said: E.3 TheFLVFileBody have a table: Field Type Comment PreviousTagSize0 UI32 Always 0 Reviewed-by: Bela Bodecs <bodecsb@vivanet.hu> Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* | Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-21
|\| | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-30
| | | | | | | | | | | | | | | | It is supposed to be a flag. The only currently defined value is AVIO_SEEKABLE_NORMAL, but other ones may be added in the future. However all the current lavf code treats this field as a bool (mainly for historical reasons). Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.