[FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size

Yusuke Nakamura muken.the.vfrmaniac at gmail.com
Sun May 24 09:21:37 CEST 2015


2015-05-24 7:04 GMT+09:00 Andreas Cadhalpun <
andreas.cadhalpun at googlemail.com>:

> Without this the mov demuxer can return a large number of empty packets.
>
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  libavformat/mov.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index f6f07be..a6290d1 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -4260,6 +4260,11 @@ static int mov_read_packet(AVFormatContext *s,
> AVPacket *pkt)
>          sample->size = FFMIN(sample->size, (mov->next_root_atom -
> sample->pos));
>      }
>
> +    if (!sample->size) {
> +        av_log(s, AV_LOG_ERROR, "sample size is zero\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +
>      if (st->discard != AVDISCARD_ALL) {
>          if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
>              av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64":
> partial file\n",
> --
> 2.1.4
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

14496-12 does not prohibit sample_size = 0.

See ISO/IEC 14496-12:2012 Corrected ver. 8.7.3.1 Definition.

NOTE A sample size of zero is not prohibited in general, but it must be
valid and defined for the coding
system, as defined by the sample entry, that the sample belongs to.


More information about the ffmpeg-devel mailing list