summaryrefslogtreecommitdiff
path: root/libavformat/mvdec.c
Commit message (Collapse)AuthorAge
* mvdec: convert to new channel layout APIVittorio Giovara2022-03-15
| | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mvdec: re-indent after last commitJohn-Paul Stewart2022-01-08
| | | | | | Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Reviewed-by: Peter Ross <pross@xvid.org>
* avformat/mvdec: make audio stream conditionalJohn-Paul Stewart2022-01-08
| | | | | | | | | | | | | | | Only allocate an audio stream if there is one in the data. Silicon Graphics movie format will contain default values (16 bit samples, 2 audio channels, 22050 Hz sample rate) even when no audio is present in the file. This confuses FFmpeg into thinking such an audio stream is present with 0 samples in it. There is a flag value in the format to indicate whether or not audio is present. This patch checks that and behaves accordingly. Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Reviewed-by: Peter Ross <pross@xvid.org>
* avformat/mvdec: Check bytes_per_sampleMichael Niedermayer2021-12-25
| | | | | | | | | | Fixes: division by zero Fixes: 42814/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4787014237552640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Reviewed-by: John-Paul Stewart <jpstewart@personalprojects.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mvdec: explicitly set durationJohn-Paul Stewart2021-12-21
| | | | | | | | Resolves a warning that duration is being innaccurately estimated based on bitrate. Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net> Reviewed-by: Peter Ross <pross@xvid.org>
* avformat/mvdec: read frame rate from data streamJohn-Paul Stewart2021-12-21
| | | | | | | | | | Prior to this patch, for version 2 of the file format the frame rate was hard-coded at 15 fps. This uses the 64-bit floating-point value from the data stream, similar to what is already done for version 3 of the file format (around line 206). Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net> Reviewed-by: Peter Ross <pross@xvid.org>
* 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/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>
* avformat/mvdec: fix reading number of audio channelsJohn-Paul Stewart2021-12-03
| | | | | | | | | The number of audio channels is stored after the magic number identifying the audio format. Prior to this patch the code has been reading it earlier, causing files with only one audio channel to be handled incorrectly. Reviewed-by: Peter Ross <pross@xvid.org>
* 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/mvdec: Don't signal success on parse_audio_var() errorJames Almer2021-09-16
| | | | | | Propagate the error it returned instead. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mvdec: Do not set invalid sample rateMichael Niedermayer2021-09-16
| | | | | | | | | Fixes: signed integer overflow: -682581959642593728 * 16 cannot be represented in type 'long' Fixes: 37883/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5311691517198336 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/mvdec: Check sample rate in parse_audio_var()Michael Niedermayer2021-05-04
| | | | | | | | | Fixes: signed integer overflow: -635424002382840000 * 16 cannot be represented in type 'long' Fixes: 33612/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5704741108711424 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: 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/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/mvdec: Check for EOF in read_index()Michael Niedermayer2021-02-10
| | | | | | | | Fixes: Timeout Fixes: 29550/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5094307193290752 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: Sanity check SAMPLE_WIDTHMichael Niedermayer2021-02-04
| | | | | | | | | Fixes: signed integer overflow: 999999999 * 8 cannot be represented in type 'int' Fixes: 30048/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5864289917337600 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>
* 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/mvdec: Fix integer overflow with billions of channelsMichael Niedermayer2020-06-27
| | | | | | | | Fixes: signed integer overflow: 1394614304 * 2 cannot be represented in type 'int' Fixes: 23491/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5697377020411904 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: Check stream numbersMichael Niedermayer2020-02-25
| | | | | | | | | Fixes: null pointer dereference Fixes: 20768/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5638648978735104.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mvdec: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-21
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* avformat/mvdec: check for EOFPaul B Mahol2017-11-05
| | | | | | Fixes #6805. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat/mvdec: Fix DoS due to lack of eof checkMichael Niedermayer2017-08-27
| | | | | | | Fixes: loop.mv Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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.
* | mvdec: validate sample_rateAndreas Cadhalpun2016-11-07
| | | | | | | | | | | | | | A negative sample rate doesn't make sense and triggers assertions in av_rescale_rnd. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* | avformat/mvdec: Use 64bit for ret to avoid overflowMichael Niedermayer2015-02-20
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/mvdec: Check size in read_table() for validityMichael Niedermayer2014-10-28
| | | | | | | | | | | | | | | | | | | | | | | | This check is redundant with the previous commit but it provides better error messages and feedback while the previous commit ensures that var_read_string() doesnt return uninitialized arrays if it itself is feeded with an invalid size possibly through a different future codepath. Fixes: asan_heap-oob_49b1e5_12_011.movie Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/mvdec: Check size for validity in var_read_string()Michael Niedermayer2014-10-28
| | | | | | | | | | | | | | Fixes out of array read Fixes: asan_heap-oob_49b1e5_12_011.movie Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '55ddd700c67529ff2c6c4e976673f1341bba7a82'Michael Niedermayer2014-04-19
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit '55ddd700c67529ff2c6c4e976673f1341bba7a82': Silicon Graphics Movie demuxer Conflicts: Changelog libavformat/mvdec.c libavformat/version.h See: 6fb40779cd3457a819e20d6db91a142c47cad3c2 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Silicon Graphics Movie demuxerPeter Ross2014-04-19
| | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavc & lavf: replace deprecated av_log* functionsPaul B Mahol2013-03-15
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* mvdec: check var_read_string() return valueMichael Niedermayer2013-01-27
| | | | | | | Prevent null pointer dereference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* mvdec: Check the frame counter against the correct limit.Michael Niedermayer2013-01-27
| | | | | | | fixes out of array reads Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* mvdec: check channel count.Michael Niedermayer2013-01-22
| | | | | | | Fixes division by 0 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* mvdec: minor simplification, remove av_inv_q()Michael Niedermayer2013-01-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* mvdec: use avpriv_set_pts_info() instead of directly setting tb.Michael Niedermayer2013-01-22
| | | | | | | Fixes division by 0 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* mcdec: suppress "warning: a/vst may be used uninitialized in this function"Michael Niedermayer2012-12-24
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Silicon Graphics Movie (.mv) demuxerPeter Ross2012-12-17
Signed-off-by: Peter Ross <pross@xvid.org>