summaryrefslogtreecommitdiff
path: root/libavformat/swfdec.c
Commit message (Collapse)AuthorAge
* avformat/utils: Move ff_add_param_change to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | Only demuxers have a need to add side-data to a packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swf: 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: 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: 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>
* lavf/swfdec: Allow decoding Nellymoser in swf.Carl Eugen Hoyos2021-03-20
| | | | Such files exist in the wild, see ticket #9153.
* avformat/swfdec: Check outlen before allocationMichael Niedermayer2021-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: Timeout (too long -> 241ms) Fixes: 29083/clusterfuzz-testcase-minimized-ffmpeg_dem_SWF_fuzzer-6273684478230528 The source of the magic number is A very quick simulation of the best case compression for "compress" below is not nice written code as i did not expect I or anyone else would ever see it again I would have preferred some nicer expression or course, but thats what it seems to be asymptotically. For smaller amounts of data a tighter bound is possible but i saw no nice way to consider that and it seems also overkill to try to do it more fine grained for just this main(){ int64_t bits = 0; int bank = 256; int bitbank = 8; for(unsigned i = 0; i<1024*1024*1024*4U-100000;) { int word_size = bank-255; i += word_size; bits += bitbank; if (!(bank & (bank-1))) bitbank ++; bank++; if (bitbank > 16) { printf("BEST %f \n", 8.0 * i / bits ); bank = 256; bitbank = 8; } } } above assumes i remembered correctly how the algorithm works but the value was close to what actual compession of zeros gave Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/swf: add support for reading and writing VP6A and Flash Screen ↵Marton Balint2021-01-23
| | | | | | Video codecs Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/swfdec: Allocate output buffer after reading inputMichael Niedermayer2020-12-24
| | | | | | | | Fixes: Timeout (>10sec -> 0.26sec) Fixes: 27419/clusterfuzz-testcase-minimized-ffmpeg_dem_SWF_fuzzer-5678307361947648 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.{*skip_samples.*_discard_sample} to AVStreamInternalAnton Khirnov2020-10-28
| | | | | Those are private fields, no reason to have them exposed in a public header.
* avformat/swfdec: Reorder allocations/initializationsAndreas Rheinhardt2020-09-23
| | | | | | | | | | | | | | | | | The earlier code would first attempt to allocate two buffers, then attempt to allocate an AVIOContext, using one of the new buffers I/O buffer, then check the allocations. On success, a z_stream that is used in the AVIOContext's read_packet callback is initialized afterwards. There are two problems with this: In case the allocation of the I/O buffer fails avio_alloc_context() will be given a NULL read buffer with a size > 0. This works right now, but it is fragile. The second problem is that the z_stream used in the read_packet callback is not functional when avio_alloc_context() is allocated (it might be that avio_alloc_context() might already fill the buffer in the future). This commit fixes both of these problems by reordering the operations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/swfdec: Fix memleaks on errorAndreas Rheinhardt2020-09-23
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/swf: Separate mux and demux contextsAndreas Rheinhardt2020-09-20
| | | | | | | | | There was almost no overlap between them: The only field used by both was an int named samples_per_frame. Therefore this commit separates them. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/swfdec: Avoid unnecessary skipAndreas Rheinhardt2020-09-20
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: Remove unnecessary av_packet_unref()Andreas Rheinhardt2020-02-10
| | | | | | | | | Since bae8844e the packet will always be unreferenced when a demuxer returns an error, so that a lot of calls to av_packet_unref() in lots of demuxers are now redundant and can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/swfdec: fix memleak when inflateInit failedSteven Liu2019-10-28
| | | | 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
* lavf/swfdec: Reduce score when auto-detecting swf files.Carl Eugen Hoyos2018-01-20
| | | | Not more than 32bit are tested.
* Use the new AVIOContext destructor.Anton Khirnov2017-09-01
| | | | | (cherry picked from commit 6f554521afdf7ab4edbfaa9536660a1dca946b19) Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: fix typosMoritz Barsnick2016-10-09
| | | | | Signed-off-by: Moritz Barsnick <barsnick@gmx.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/swfdec: Fix memleak on errorMichael Niedermayer2016-08-22
| | | | | | | Fixes: 9eb9cf5b8c26dd0fa7107ed0348dcc1f/signal_sigabrt_7ffff6ae7c37_8925_1f676b5229d009f2b56dfd9e149fa6ba.swf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/swfdec: Fix inflate() error code checkMichael Niedermayer2016-08-19
| | | | | | | | Fixes infinite loop Fixes endless.poc Found-by: 连一汉 <lianyihan@360.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/swfdec: Move packet size check before side data allocationMichael Niedermayer2016-08-19
| | | | | | | | Fixes memleak Fixes: 9eb9cf5b8c26dd0fa7107ed0348dcc1f/signal_sigabrt_7ffff6ae7c37_8927_f14c2a6ae1ad0bbde2c94f1da50e7074.swf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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.
* | Merge commit '7570c9e04f010c9b3bfdeb4338d330f2cdd25278'Hendrik Leppkes2016-01-19
|\| | | | | | | | | | | | | * commit '7570c9e04f010c9b3bfdeb4338d330f2cdd25278': swfdec: support compressed swf Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * swfdec: support compressed swfClément Bœsch2016-01-11
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-27
| |
* | avformat/swfdec: Check return value of init_get_bits8()Michael Niedermayer2015-09-03
| | | | | | | | | | | | Fixes: CID1322320 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Replace av_dlog with ff_dlog.Ronald S. Bultje2015-08-18
| | | | | | | | | | ff_dlog checks compilability, and is non-public. av_dlog is deprecated and no longer exists if FF_API_DLOG=0.
* | lavf/swf: Fix auto-detection of compressed files.Carl Eugen Hoyos2015-08-04
| | | | | | | | | | | | Fixes auto-detection of compressed swf files as in http://samples.ffmpeg.org/SWF/compressed-swf/ Reported by forum user Zard1096.
* | avformat/swfdec: Fix "}else" styleMichael Niedermayer2015-07-08
| | | | | | | | | | Found-by: durandal_170 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: Do not error out on pixel format changesMichael Niedermayer2015-07-08
| | | | | | | | | | | | | | | | Instead print an error and continue Fixes Ticket4702 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: Check frame size rectangle in probe()Michael Niedermayer2014-12-21
| | | | | | | | | | | | fixes probetest failure Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: Do not change the pixel formatMichael Niedermayer2014-09-07
| | | | | | | | | | | | | | This is currently not supported Fixes part of Ticket 3539 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: Use side data to communicate w/h changes to the decoderMichael Niedermayer2014-09-02
| | | | | | | | | | | | | | | | Fixes reading from freed data Fixes part of Ticket3539 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | replace calls to url_feof() with avio_feof()James Almer2014-08-08
| | | | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: clear 4 bytes at the end of a packet if they are not ↵Michael Niedermayer2013-12-19
| | | | | | | | | | | | | | | | | | initialized Fixes use of uninitialized memory Fixes part of msan_uninit-mem_7f055dd0ab1b_9558_videopop_guitar_300k.swf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: check avio_read() return codeMichael Niedermayer2013-12-19
| | | | | | | | | | | | | | Fixes use of uninitialized memory Fixes part of msan_uninit-mem_7f055dd0ab1b_9558_videopop_guitar_300k.swf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: check avio_read() return codeMichael Niedermayer2013-12-19
| | | | | | | | | | | | | | Fixes use of uninitialized memory Fixes msan_uninit-mem_7f90d9cce964_9558_videopop_guitar_300k.swf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: return AVPROBE_SCORE_MAX / 4 for unexpected versionsMichael Niedermayer2013-11-10
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/swfdec: check version and size during probingMichael Niedermayer2013-11-06
| | | | | | | | | | | | Fixes probetest failure Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf/swfdec: remove 8-bit audio FIXME.Clément Bœsch2013-02-21
| | | | | | | | Implemented since 624fb5f9.
* | lavf/swfdec: support 8-bits PCM audio.Clément Bœsch2013-02-20
| |
* | lavf/swfdec: factorize the creation of a new stream.Clément Bœsch2013-02-20
| | | | | | | | This also makes the changes of a3949fe11 applicable in both cases.
* | Merge commit 'd04c17c91363a6b15d1ac2d79c817f3d5e2998b3'Michael Niedermayer2012-12-12
|\| | | | | | | | | | | | | * commit 'd04c17c91363a6b15d1ac2d79c817f3d5e2998b3': swfdec: cosmetics: fix indentation Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * swfdec: cosmetics: fix indentationJustin Ruggles2012-12-11
| |
* | swfdec: print warning when len is clipedMichael Niedermayer2012-12-12
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'e70c5b034c4787377e82cab2d5565486baec0c2a'Michael Niedermayer2012-12-12
|\| | | | | | | | | | | | | | | | | | | | | * commit 'e70c5b034c4787377e82cab2d5565486baec0c2a': swfdec: do better validation of tag length Make LOCAL_ALIGNED syntactically similar on all systems Conflicts: libavformat/swfdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * swfdec: do better validation of tag lengthJustin Ruggles2012-12-11
| | | | | | | | | | | | | | Avoids trying to read a packet with 0 or negative size. Avoids a potential infinite loop due to seeking backwards. Partially based on a patch by Michael Niedermayer.