Commit Graph

297 Commits

Author SHA1 Message Date
James Almer fe421d4dee Merge commit '95ce02b35d3d1bb16111031df1d82a6e4d894d36'
* commit '95ce02b35d3d1bb16111031df1d82a6e4d894d36':
  rmdec: don't ignore the return value of av_get_packet()

See 65b83ce01b

Merged-by: James Almer <jamrial@gmail.com>
2017-11-07 19:17:26 -03:00
孙浩 and 张洪亮(望初) 124eb202e7 avformat/rmdec: Fix DoS due to lack of eof check
Fixes: loop.ivr

Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-27 19:23:13 +02:00
Sean McGovern 95ce02b35d rmdec: don't ignore the return value of av_get_packet() 2017-07-17 07:08:13 -04:00
Clément Bœsch 549045254c Fix all -Wformat warnings raised by DJGPP 2017-03-29 14:49:29 +02:00
Clément Bœsch bec96a7286 lavf: use av_fourcc2str() where appropriate 2017-03-29 14:49:29 +02:00
James Almer 4de591e6fb Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'
* commit '83548fe894cdb455cc127f754d09905b6d23c173':
  lavf: fix usage of AVIOContext.seekable

Merged-by: James Almer <jamrial@gmail.com>
2017-03-21 17:02:30 -03:00
Clément Bœsch 3eed90b1ed Merge commit 'd9442d13033a24b14ebae149dcdb42709430e2d9'
* commit 'd9442d13033a24b14ebae149dcdb42709430e2d9':
  rm: Drop broken disabled cruft

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-19 15:49:47 +01:00
Paul B Mahol 40cf943714 avcodec: add SIPR parser
Fixes #2056.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-01-16 10:24:01 +01:00
Diego Biurrun 0b77a59336 Use correct printf conversion specifiers for POSIX integer types 2016-12-23 19:30:00 +01:00
Andreas Cadhalpun de4ded0636 rmdec: validate block alignment
This fixes division by zero crashes.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-23 00:57:10 +01:00
Anton Khirnov 83548fe894 lavf: fix usage of AVIOContext.seekable
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.
2016-09-30 16:54:33 +02:00
Diego Biurrun d9442d1303 rm: Drop broken disabled cruft 2016-08-17 12:16:42 +02:00
Carl Eugen Hoyos 8ee113afa1 lavf/rmdec: Do not return EIO on EOF.
Reported-by: applemax82
2016-08-02 16:16:31 +02:00
Michael Niedermayer 0219dc6c07 avformat/rmdec: Clear extradata when extradata_size is cleared
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-29 12:12:18 +02:00
Paul B Mahol 323b8c95e4 avformat: add AVFormatContext to ff_get_extradata()
Needed for av_log() inside that function.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-04-14 18:21:08 +02: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
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
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.
2016-02-23 17:01:58 +01:00
James Almer e3c188e72c avcodec/rmdec: add missing av_log argument
Also change the format specifier to expect an unsigned int

Signed-off-by: James Almer <jamrial@gmail.com>
2016-01-15 02:26:36 -03:00
Michael Niedermayer c3a24006d5 avformat/rmdec: Fix Packet memleak at close()
Fixes: asan_heap-oob_445b39_1741_d00eb645ab48eb2203b4a04a5b997103.ivr

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-14 23:49:52 +01:00
Michael Niedermayer 80fd348bb7 avformat/rmdec: Check size in ivr_read_packet() before use
Fixes out of array access
Fixes: asan_heap-oob_445b39_1741_d00eb645ab48eb2203b4a04a5b997103.ivr

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-14 23:49:52 +01:00
Carl Eugen Hoyos b18230ee8c lavf/rmdec: Use correct format specifier for int64_t.
Fixes ticket #5100.
2015-12-22 09:29:08 +01:00
Michael Niedermayer 80ceb4696a avformat/rmdec: Fix use of uninitialized variable
Fixes: CID1341580

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-09 18:17:47 +01:00
Paul B Mahol 35bbc1955a avformat: add IVR demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-18 12:54:02 +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 7f5af80ba4 Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'
* commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457':
  avpacket: Replace av_free_packet with av_packet_unref

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 14:28:56 +01:00
Luca Barbato ce70f28a17 avpacket: Replace av_free_packet with av_packet_unref
`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.

Deprecate `av_free_packet`.
2015-10-26 18:00:55 +01:00
Hendrik Leppkes 87c8812270 Merge commit '01bcc2d5c23fa757d163530abb396fd02f1be7c8'
* commit '01bcc2d5c23fa757d163530abb396fd02f1be7c8':
  lavc: Drop deprecated destruct_packet related functions

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-05 16:50:09 +02:00
Vittorio Giovara 01bcc2d5c2 lavc: Drop deprecated destruct_packet related functions
Deprecated in 10/2012.
2015-08-28 16:01:16 +02:00
Michael Niedermayer 856452cf63 avformat/rmdec: MLTI with multiple MDPR support
Fixes Ticket4496

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-14 04:40:00 +02:00
Michael Niedermayer 02fff49936 avformat/rmdec: Move MLTI handling out of ff_rm_read_mdpr_codecdata()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-14 03:32:00 +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
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Michael Niedermayer 40d552dae6 Merge commit '1a3eb042c704dea190c644def5b32c9cee8832b8'
* commit '1a3eb042c704dea190c644def5b32c9cee8832b8':
  Replace av_dlog with normal av_log at trace level

Conflicts:
	ffplay.c
	libavdevice/fbdev_dec.c
	libavfilter/avfilter.c
	libavfilter/internal.h
	libavfilter/setpts.c
	libavfilter/src_movie.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fieldorder.c
	libavformat/assdec.c
	libavformat/avidec.c
	libavformat/flvdec.c
	libavformat/http.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/mov.c
	libavformat/mpegenc.c
	libavformat/mpegts.c
	libavformat/mpegtsenc.c
	libavformat/mux.c
	libavformat/mxfdec.c
	libavformat/nsvdec.c
	libavformat/oggdec.c
	libavformat/r3d.c
	libavformat/rtspdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 03:19:47 +02:00
Vittorio Giovara 1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Michael Niedermayer df43d03731 avformat/rmdec: fix support for 0 sized mdpr
Fixes Ticket4393

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-26 02:02:18 +01:00
Carl Eugen Hoyos 0f9f7969ef rmdec: Improve message for demux error
Use correct context, reduce log level, don't assume it is a video stream,
and print the tag of the unknown stream.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-03-08 02:35:04 +00:00
Andreas Cadhalpun 482c86f231 fix spelling errors
opttimizations -> optimizations
 grabing        -> grabbing
 many resource  -> many resources
 isnt           -> isn't
 silcense       -> silence

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-06 21:35:00 +01:00
Michael Niedermayer 575ed4fe37 Merge commit 'da7e31a240f276836a0b90ca6c0714181b353cc4'
* commit 'da7e31a240f276836a0b90ca6c0714181b353cc4':
  rmdec: Check memory allocations from ff_rm_alloc_rmstream()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 21:42:36 +01:00
Hugo Beauzée-Luyssen da7e31a240 rmdec: Check memory allocations from ff_rm_alloc_rmstream()
Bug-Id: CID 1257835
2015-02-17 12:16:43 -05:00
Michael Niedermayer a0fe1a25fa Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'
* commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e':
  avformat: Don't anonymously typedef structs

Conflicts:
	libavformat/adtsenc.c
	libavformat/aiffenc.c
	libavformat/avidec.c
	libavformat/gif.c
	libavformat/iff.c
	libavformat/img2dec.c
	libavformat/jvdec.c
	libavformat/matroskadec.c
	libavformat/udp.c
	libavformat/wtvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:07:40 +01:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Michael Niedermayer 65b83ce01b avformat/rmdec: Check the return value of av_get_packet()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-18 20:55:49 +01:00
wm4 aab74a38b8 rm: fix memory leak on init failure
AVInputFormat.read_close is not called if AVInputFormat.read_header
fails, so this needs to be handled separately.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 00:26:43 +01:00
Michael Niedermayer 03abf55f25 avformat/rmdec: Check for overflow in ff_rm_read_mdpr_codecdata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-06 00:49:23 +01:00
Michael Niedermayer 50f9de59a0 avformat/rmdec: rm_read_extradata: add error message for oversized extradata
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-06 00:49:20 +01:00
Michael Niedermayer ef2f9073dd Merge commit '1c77ead1fb14d64e6798fc5e32af04abcb3cebb4'
* commit '1c77ead1fb14d64e6798fc5e32af04abcb3cebb4':
  rm: Use the correct codec_data_size signedness

Conflicts:
	libavformat/rm.h
	libavformat/rmdec.c

See: a6f730730b
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-06 00:48:47 +01:00
Luca Barbato 1c77ead1fb rm: Use the correct codec_data_size signedness
The function takes a size and not an offset.

CC: libav-stable@libav.org
Sample-Id: rm_deadlock.rm

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-12-04 13:14:28 +00:00
Michael Niedermayer a6f730730b avformat/rmdec: Check codec_data_size
Fixes infinite loop
Fixes Ticket4154

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-03 20:01:18 +01:00
Carl Eugen Hoyos 5badcdf20d Rename sync() functions in libavformat.
Fixes compilation on Android where the sync() definition in
unistd.h interferes with the static definitions in libavformat.
2014-11-25 23:49:58 +01:00
Michael Niedermayer 979062fe2f Merge commit 'be42c0b8d57fe2ea769892d102ffd5561dc18709'
* commit 'be42c0b8d57fe2ea769892d102ffd5561dc18709':
  rmdec: stricter error check to avoid theoretical unitialized use

Conflicts:
	libavformat/rmdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-21 23:47:44 +02:00