Commit Graph

523 Commits

Author SHA1 Message Date
Paul B Mahol 6972dae5a4 avformat/avidec: fix demuxing of all keyframes of sample 200707170736151.avi 2018-08-21 12:14:44 +02:00
Michael Niedermayer 06e092e781 avformat/avidec: Fix integer overflow in cum_len check
Fixes: signed integer overflow: 3775922176 * 4278190080 cannot be represented in type 'long'
Fixes: Chromium bug 791237

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
James Almer ae100046ca avcodec/exif: remove GetByteContext usage from avpriv_exif_decode_ifd()
This prevents potential ABI issues with GetByteContext.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-26 00:45:49 -03:00
Anton Khirnov 78a7af823b Use the new AVIOContext destructor.
(cherry picked from commit 6f554521af)
Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-01 02:16:33 -03:00
Michael Niedermayer 511e10f673 avformat/avidec: Move packet skip after prefix and related checks
This fixes loosing packets
Fixes: big.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-11 12:07:08 +02:00
Michael Niedermayer a5d849b149 avformat/avidec: Limit formats in gab2 to srt and ass/ssa
This prevents part of one exploit leading to an information leak

Found-by: Emil Lerner and Pavel Cheremushkin
Reported-by: Thierry Foucu <tfoucu@google.com>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-31 02:32:42 +02:00
Michael Niedermayer 78f6ec32a3 avformat/avidec: Fix txts fmts parsing
Fixes: subtitle.avi from vlc/ticket/1162

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-31 02:32:42 +02:00
Clément Bœsch bec96a7286 lavf: use av_fourcc2str() where appropriate 2017-03-29 14:49:29 +02:00
Clément Bœsch cd4d6cba12 lavf: fix usages of av_get_codec_tag_string() 2017-03-29 14:49:29 +02:00
Clément Bœsch 1436769c57 Merge commit 'ca1e5eea0c7b72a6e30aa6488cfeced3a4853521'
* commit 'ca1e5eea0c7b72a6e30aa6488cfeced3a4853521':
  Remove some pointless TRACE level debug code

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-24 13:23:52 +01:00
Clément Bœsch 554cc43ac6 Merge commit 'bad4aad4037f59ba0ad656164be9ab8f7a0fa2d4'
* commit 'bad4aad4037f59ba0ad656164be9ab8f7a0fa2d4':
  avidec: Do not special case palette on big-endian

This commit is a noop, see 64cafe340b

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-23 11:26:32 +01: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
Tobias Rapp 5796048f6a avformat/avidec: clean-up identifier names
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-03 13:46:55 +01:00
Tobias Rapp 6d579d7c1b avformat/avidec: skip odml master index chunks in avi_sync
Fixes pts gaps when reading AVI files > 256GiB generated by FFmpeg.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-23 21:47:47 +01:00
Andreas Cadhalpun 2c908f22c2 avidec: fix leaking extradata
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-30 02:22:50 +01:00
Diego Biurrun ca1e5eea0c Remove some pointless TRACE level debug code
This also kills some warnings with certain compiler options.
2016-10-27 12:54:14 +02:00
Carl Eugen Hoyos 31a0a84216 lavf/avidec: Be more verbose when ignoring very large tag size. 2016-10-18 15:01:50 +02:00
Carl Eugen Hoyos a20f3238be lavf/avidec: Do not fail for very large idx1 tags.
Fixes demuxing the sample file from github pull request 197,
the size of its idx1 tag is 6171936 bytes, followed by a JUNK
tag of 9505704 bytes.
2016-10-18 00:25:41 +02:00
Vittorio Giovara bad4aad403 avidec: Do not special case palette on big-endian
This simplifies the code a bit, does not change output data in any way.
2016-10-02 15:42:03 -04:00
Vittorio Giovara 497c087939 avidec: Set palette alpha as fully opaque
Palette format is always in RGBA.
2016-10-02 15:42:03 -04: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
Michael Niedermayer 2679ad4773 avformat/avidec: Check nb_streams in read_gab2_sub()
Fixes null pointer dereference
Fixes: 1/null_point.avi

Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-28 16:46:24 +02:00
Michael Niedermayer 14bac7e00d avformat/avidec: Remove ancient assert
This assert can with crafted files fail, a warning is already printed
for this case.

Fixes assertion failure
Fixes:1/assert.avi

Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-28 16:46:24 +02:00
James Almer aa0dc698db avformat/avidec: remove warning about deprecated declarations
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-25 16:03:21 -03:00
Michael Niedermayer b98dafe045 avformat/avidec: Fix memleak with dv in avi
Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-25 19:06:51 +02:00
Michael Niedermayer e4e4a9cad7 avformat/avidec: Fix infinite loop in avi_read_nikon()
Fixes: 360/test.poc

Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-02 13:57:40 +02:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Michael Niedermayer d08f2c172f avformat/avidec: Detect index with too short entries
Fixes Ticket5498

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-18 23:59:02 +02:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +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
Mats Peterson d8a1633ee4 lavf/avidec: Add blurb regarding the skipping of xxpc entries in the index
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-18 13:47:43 +01:00
Mats Peterson caeed0479f lavf/avidec: Skip xxpc entries in index; fixes trac #5311
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-10 00:30:39 +01:00
Derek Buitenhuis 93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00: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
Hendrik Leppkes 6a6cfeb2e7 Merge commit '5f3a081b42b84404a40a52c80ef7a354cf048c56'
* commit '5f3a081b42b84404a40a52c80ef7a354cf048c56':
  avi: Spin out the logic to position to the next non-interleaved stream

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-08 09:41:43 +01:00
Hendrik Leppkes e92aa34d7b Merge commit 'd017ed878a45171f2f6c69fb9d76401c3c494110'
* commit 'd017ed878a45171f2f6c69fb9d76401c3c494110':
  avi: Use the correct data type

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-07 15:57:02 +01: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
Luca Barbato 5f3a081b42 avi: Spin out the logic to position to the next non-interleaved stream
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-12-02 23:49:10 +01:00
Luca Barbato d017ed878a avi: Use the correct data type
avio_tell returns an int64_t.
2015-12-02 23:49:10 +01:00
Michael Niedermayer 0fc61c6ab6 avi: Validate the stream-id for DV as well
Avoid false positives while syncing.

Bug-Id: ffmpeg/4086
Bug-Id: 879

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-12-02 23:49:10 +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
Michael Niedermayer d64f7d4213 avformat/avidec: disable parsing for RV40
Fixes: broken_rv40.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-17 02:08:15 +02:00
Michael Niedermayer 59c1fec9fb avformat/avidec: Change (last)pos to 64bit
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-15 04:26:19 +02:00
Michael Niedermayer 3e2ef00394 avformat/avidec: Workaround broken initial frame
Fixes Ticket4851

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-15 04:26:19 +02: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 0d2a62d257 avformat/avidec: Simplify dshow_block_align based special case detection
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-12 22:51:40 +02:00