Commit Graph

43 Commits

Author SHA1 Message Date
Soft Works 35d784aca9 libavformat/asfdec: Add braces to define
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-30 14:02:27 +02:00
Soft Works c8cdf641c7 libavformat/asfdec: Use predefined constants
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-30 14:02:27 +02:00
Andreas Rheinhardt 40bdd8cc05 avformat: Avoid allocation for AVStreamInternal
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>
2021-09-17 13:22:25 +02:00
Andreas Rheinhardt fed0282508 avformat: Avoid allocation for AVFormatInternal
Do this by allocating AVFormatContext together with the data that is
currently in AVFormatInternal; or rather: Put AVFormatContext at the
beginning of a new structure called FFFormatContext (which encompasses
more than just the internal fields and is a proper context in its own
right, hence the name) and remove AVFormatInternal altogether.

The biggest simplifications occured in avformat_alloc_context(), where
one can now simply call avformat_free_context() in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-17 04:58:34 +02:00
Michael Niedermayer f034c2e36a avformat/asfdec_f: Check sizeX against padding
Fixes: signed integer overflow: 2147483607 + 64 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6753897878257664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-31 22:08:16 +02:00
James Almer b9c5fdf602 avformat: move AVStream.{parser,need_parsing} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-07 09:27:21 -03:00
Andreas Rheinhardt bc70684e74 avformat: Constify all muxer/demuxers
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>
2021-04-27 11:48:06 -03:00
Andreas Rheinhardt dfeb9b3a8b avformat/asf: Factor common code out
Both functions to read attached pictures coincide since
e83f27a21a (save for some log messages
in case av_dict_set failed).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-03-31 22:01:36 +02:00
Andreas Rheinhardt 3750390ede avformat/asfdec_f: Avoid stack packet
Replace it by using AVFormatInternal.parse_pkt which is otherwise unused
when reading a header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-24 00:19:54 +01:00
Andreas Rheinhardt 6f3fe7b2c0 avformat/asf: Move ff_asf_audio_conceal_none to its only user
It is only used inside code guarded by #ifdef DEBUG, i.e. it is normally
unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-24 08:17:50 +01:00
Michael Niedermayer 2c8cd4490a avformat/asfdec_f: Add an additional check for the extradata size
Fixes: OOM
Fixes: 30066/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6182309126602752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-09 19:37:27 +01:00
Anton Khirnov cea7c19cda lavf: move AVStream.*index_entries* to AVStreamInternal
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.
2020-10-28 14:59:28 +01:00
Anton Khirnov 108864acee lavf: move AVStream.{request_probe,skip_to_keyframe} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:57:01 +01:00
Michael Niedermayer 209b9ff5c3 avformat/asfdec_f: Check for negative ext_len
Fixes: Infinite loop
Fixes: 26376/clusterfuzz-testcase-minimized-ffmpeg_dem_PCM_U32LE_fuzzer-6050518830678016
Fixes: 26377/clusterfuzz-testcase-minimized-ffmpeg_dem_TY_fuzzer-4838195726123008
Fixes: 26384/clusterfuzz-testcase-minimized-ffmpeg_dem_G729_fuzzer-5173450337157120
Fixes: 26396/clusterfuzz-testcase-minimized-ffmpeg_dem_PCM_S24BE_fuzzer-5071092206796800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-23 10:07:57 +02:00
Michael Niedermayer 0d088a47ca avformat/asfdec_f: Check name_len for overflow
Fixes: signed integer overflow: -1172299744 * 2 cannot be represented in type 'int'
Fixes: 26258/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5672758488596480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-20 15:33:13 +02:00
Michael Niedermayer 686f015190 avformat/asfdec_f: Change order or operations slightly
Fixes: signed integer overflow: 20 * 5184056935931942919 cannot be represented in type 'long'
Fixes: 25466/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4798660247552000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-02 14:59:53 +02:00
Andreas Rheinhardt 37140ebd87 avformat/id3v2: Remove unnecessary indirection
ff_id3v2_parse_apic/chapters/priv/priv_dict all had a parameter
extra_meta of type ID3v2ExtraMeta ** as if the functions wanted to make
*extra_meta point to something else. But they don't, so just use an
ID3v2ExtraMeta *.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-25 07:06:44 +02:00
Michael Niedermayer c8140fe732 avformat/asfdec_f: Fix overflow check in get_tag()
Fixes: signed integer overflow: 2 * 1210064928 cannot be represented in type 'int'
Fixes: 20873/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5761116909338624

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>
2020-03-21 20:55:27 +01:00
Carl Eugen Hoyos 4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
Lukas Stabe 1fd80106be avformat: fix id3 chapters
These changes store id3 chapter data in ID3v2ExtraMeta and introduce
ff_id3v2_parse_chapters to parse them into the format context if needed.

Encoders using ff_id3v2_read, which previously parsed chapters into the
format context automatically, were adjusted to call
ff_id3v2_parse_chapters.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-10-05 17:10:23 +02:00
Michael Niedermayer afc9c683ed avformat/asfdec: Fix DoS in asf_build_simple_index()
Fixes: Missing EOF check in loop
No testcase

Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-07 15:19:22 +02:00
孙浩 and 张洪亮(望初) 7f9ec5593e avformat/asfdec: Fix DoS due to lack of eof check
Fixes: loop.asf

Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-27 19:21:42 +02:00
Carl Eugen Hoyos 5a237c33b8 lavf/asfdec_f: Remove CR/LF from avpriv_request_sample() call. 2016-12-03 15:41:27 +01:00
James Almer 1582e306a4 avformat/avlanguage: make av_convert_lang_to() internal
The header was never installed and the function is only used in libavformat

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 21:43:14 -03:00
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* 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>
2016-04-10 20:59:55 +01:00
Lou Logan 06eef96b69 fix some a/an typos
Signed-off-by: Lou Logan <lou@lrcd.com>
2016-03-28 14:13:17 -08:00
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Hendrik Leppkes 75c3e54d1c asfdec: fix FATE seek test 2015-10-27 15:29:12 +01:00
Hendrik Leppkes c2f861ca42 Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
Hendrik Leppkes 83a5df54ea Remove left-over FF_API_DESTRUCT_PACKET cruft 2015-09-05 16:51:53 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* 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>
2015-07-27 23:15:19 +02:00
Michael Niedermayer 9837d3b068 avformat/asfdec_f: Parse ECC byte according to spec
This should not change anything as the spec requires specific values
for the fields, which where handled previously.

Ask for samples when these values do not match

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 14:11:48 +02:00
Michael Niedermayer 0671dc5c53 avformat/asfdec_f: Improve packet resync heuristic
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 01:30:02 +02:00
Michael Niedermayer 5d79a07316 avformat/asfdec_f: Do not print errors if packets do not start with ECC
There is nothing wrong with such packets, the spec allows this

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 01:21:17 +02:00
Michael Niedermayer 385eb066ce avformat/asfdec_f: Increase the amount of information provided in cases of errors
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 01:08:34 +02:00
Michael Niedermayer ba77fb61f7 Merge commit 'd80811c94e068085aab797f9ba35790529126f85'
* commit 'd80811c94e068085aab797f9ba35790529126f85':
  riff: Use the correct logging context

Conflicts:
	libavformat/asfdec_o.c
	libavformat/avidec.c
	libavformat/dxa.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/riff.h
	libavformat/riffdec.c
	libavformat/wavdec.c
	libavformat/wtvdec.c
	libavformat/xwma.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 15:22:37 +02:00
Michael Niedermayer 1f69b7baa1 avformat/asfdec_f: Fix memleak
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-02 09:42:33 +02:00
John Adlum 72cad80016 avformat/asfdec_f: Add ASFDataType, use named types for metadata
This is based on asfdec_o.c, but uses a proper type instead of defines

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-02 04:58:27 +02:00
John Adlum 59fffefdb4 avformat/asfdec_f: Use dynamic allocation in asf_read_metadata() instead of a fixed size buffer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-02 04:58:23 +02:00
John Adlum c8eca438a9 avformat/asfdec_f: factor error checking out of main header parsing loop
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-02 04:58:18 +02:00
John Adlum 811008b8ee avformat/asfdec_f: Assert that packet positions match in asf_read_pts()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-01 18:47:59 +02:00
John Adlum 28206b75e8 avformat/asfdec_f: Correct skip to key code
Fixes Ticket3978

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-01 18:47:54 +02:00
Michael Niedermayer 8f9c39b3e8 avformat: rename asfdec.c to asfdec_f.c
leaving it as asfdec.c confuses git

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-30 12:23:12 +02:00