summaryrefslogtreecommitdiff
path: root/libavformat/apngdec.c
Commit message (Collapse)AuthorAge
* 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/apngdec: Remove goto fail that does nothingAndreas Rheinhardt2020-11-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/apngdec: Check fcTL chunk length when reading headerAndreas Rheinhardt2020-11-03
| | | | | | | | | | Reading the header terminates when an fcTL chunk is encountered in which case read_header returned success without checking the length of said chunk. Yet when read_packet processes this chunk, it checks for the length to be 26 and errors out otherwise. So do so when reading the header, too. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/apngdec: Fix size/overflow checksAndreas Rheinhardt2020-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | apng data consists of parts containing a small header (including a four-byte size field) and a data part; the size field does not account for everything and is actually twelve bytes short of the actual size. In order to make sure that the size fits into an int, the size field is checked for being > INT_MAX; yet this does not account for the + 12 and upon conversion to int (which happens when calling append_extradata()), the size parameter can still wrap around. In this case the currently used check would lead to undefined signed integer overflow. Furthermore, append_extradata() appends the new data to the already existing extradata and therefore needs to make sure that the combined size of new and old data as well as padding fits into an int. The check used for this is "if (old_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - new_size)". If new_size is > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE the right side becomes negative if the types are signed (as they are now); yet changing this to "if (new_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - old_size)" is better as this also works for unsigned types (where it is of course presumed that INT_MAX is replaced by the corresponding maximum for the new type). Both of these issues have been fixed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/apngdec: Return error for incomplete headerAndreas Rheinhardt2020-11-03
| | | | | | | | | | | | | | If avio_read() could read anything, it returns the number of bytes read, even if it could not read as much as the caller desired. apng_read_header() only checked the return value of its avio_read() calls for being negative and this meant that it was possible for an incomplete header to not be detected. The return value of the last successfull call has been returned instead. This commit changes this. Fixes: OOM Fixes: 26608/clusterfuzz-testcase-minimized-ffmpeg_dem_APNG_fuzzer-4839491644424192 Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/apngdec: Don't free extradata manuallyAndreas Rheinhardt2019-12-12
| | | | | | | | The extradata will be freed automatically when the corresponding stream gets freed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/apngdec: Make sure that extradata is zero-paddedAndreas Rheinhardt2019-12-12
| | | | | | | Zeroing the padding has been forgotten. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-21
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* lavf/apngdec: Return EOF for incomplete files.Carl Eugen Hoyos2018-11-08
| | | | Fixes ticket #7536.
* avformat/apngdec: set pts to AV_NOPTS_VALUEMarton Balint2018-07-02
| | | | | | | | | And let the generic code figure out the proper PTS. This is needed because apng does not provide seek functions, but after a generic seek (e.g. to file start) timestamps are not reset which causes broken timestamps when looping apngs, like in ticket #6121. Signed-off-by: Marton Balint <cus@passwd.hu>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* lavf: fix usages of av_get_codec_tag_string()Clément Bœsch2017-03-29
|
* avformat/apng: set max_fps to no limit by defaultJames Almer2017-03-21
| | | | | | | Should fix ticket #6252 Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/apng: fix setting frame delay when max_fps is set to no limitJames Almer2017-03-21
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "apngdec: use side data to pass extradata to the decoder"James Almer2016-11-18
| | | | | | | | | | | | | This reverts commit e0c6b32046f4bab7d34be77dd2f03b2a80c86d39. Said commit changed the behavior of the demuxer and decoder in a non backwards compatible way. Demuxers should make extradata available at init if possible, and send new extradata as side data within a packet if needed. A better fix for the remuxing crash will follow. Signed-off-by: James Almer <jamrial@gmail.com>
* apngdec: use side data to pass extradata to the decoderAndreas Cadhalpun2016-11-01
| | | | | | | | | Fixes remuxing apng streams coming from the apng demuxer. This is a regression since 940b8908b94404a65f9f55e33efb4ccc6c81383c. Found-by: James Almer <jamrial@gmail.com> Reviewed-by: James Almer <jamrial@gmail.com> 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>
* avformat: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-04
|
* Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '059a934806d61f7af9ab3fd9f74994b838ea5eba': lavc: Consistently prefix input buffer defines Conflicts: doc/examples/decoding_encoding.c libavcodec/4xm.c libavcodec/aac_adtstoasc_bsf.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.h libavcodec/asvenc.c libavcodec/avcodec.h libavcodec/avpacket.c libavcodec/dvdec.c libavcodec/ffv1enc.c libavcodec/g2meet.c libavcodec/gif.c libavcodec/h264.c libavcodec/h264_mp4toannexb_bsf.c libavcodec/huffyuvdec.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libxvid.c libavcodec/mdec.c libavcodec/motionpixels.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/noise_bsf.c libavcodec/nuv.c libavcodec/nvenc.c libavcodec/options.c libavcodec/parser.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/qsvdec.c libavcodec/svq1enc.c libavcodec/tiffenc.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/vc1dec.c libavcodec/wmalosslessdec.c libavformat/adxdec.c libavformat/aiffdec.c libavformat/apc.c libavformat/apetag.c libavformat/avidec.c libavformat/bink.c libavformat/cafdec.c libavformat/flvdec.c libavformat/id3v2.c libavformat/isom.c libavformat/matroskadec.c libavformat/mov.c libavformat/mpc.c libavformat/mpc8.c libavformat/mpegts.c libavformat/mvi.c libavformat/mxfdec.c libavformat/mxg.c libavformat/nutdec.c libavformat/oggdec.c libavformat/oggparsecelt.c libavformat/oggparseflac.c libavformat/oggparseopus.c libavformat/oggparsespeex.c libavformat/omadec.c libavformat/rawdec.c libavformat/riffdec.c libavformat/rl2.c libavformat/rmdec.c libavformat/rtpdec_latm.c libavformat/rtpdec_mpeg4.c libavformat/rtpdec_qdm2.c libavformat/rtpdec_svq3.c libavformat/sierravmd.c libavformat/smacker.c libavformat/smush.c libavformat/spdifenc.c libavformat/takdec.c libavformat/tta.c libavformat/utils.c libavformat/vqf.c libavformat/westwood_vqa.c libavformat/xmv.c libavformat/xwma.c libavformat/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/apngdec: Use 64bit for ret to avoid overflowMichael Niedermayer2015-02-20
| | | | | | Missed this hunk in first commit Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/apngdec: Use 64bit ret to avoid overflowMichael Niedermayer2015-02-20
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/apngdec: make tag_buf string largerClément Bœsch2014-12-20
| | | | av_get_codec_tag_string() uses more that 1 char for unprintable characters.
* avformat/apngdec: exit probing when skipping is not possible.Benoit Fouet2014-12-02
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* apng: move shared header from avformat to avcodec.Benoit Fouet2014-12-02
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/apngdec: validate frame dimensions.Benoit Fouet2014-11-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/apngdec: use packet pts and duration instead of altering stream ↵Benoit Fouet2014-11-26
| | | | | | framerate. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/apngdec: account for blend and dispose operations.Benoit Fouet2014-11-26
| | | | | | | | When the dimensions are the entire frame ones, and the dispose operation is to reset to background, or the new frame overwrites the new one, then consider the frame as a key one. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/apngdec: transmit all the chunks between consecutive fcTL ones.Benoit Fouet2014-11-24
| | | | | | | | In order to support multiple IDAT of fdAT chunks following an fcTL one, transmit all the chunks between two fcTL ones (or between fcTL and IEND one). Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavf/apngdec: print currently unsupported in-stream tags in a more readable formJames Almer2014-11-23
| | | | | | | Also use length and not stream position Reviewed-by: Benoit Fouet <benoit.fouet@free.fr> Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: fix apngdec under msvc.Matthew Oliver2014-11-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavf/apngdec: properly skip currently unsupported in-stream tagsJames Almer2014-11-22
| | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Reviewed-by: Benoit Fouet <benoit.fouet@free.fr> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/apngdec: add APNG demuxer.Benoit Fouet2014-11-21
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>