[FFmpeg-devel] [PATCH] Matroska demuxer adds WebVTT support

Michael Niedermayer michaelni at gmx.at
Tue Jul 16 01:17:56 CEST 2013


On Mon, Jul 15, 2013 at 02:08:24PM -0700, Matthew Heaney wrote:
[...]
> @@ -2226,6 +2237,115 @@ fail:
>      return ret;
>  }
>  
> +static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
> +                                 MatroskaTrack *track,
> +                                 AVStream *st,
> +                                 uint8_t *data, int data_len,
> +                                 uint64_t timecode,
> +                                 uint64_t duration,
> +                                 int64_t pos)
> +{
> +    AVPacket *pkt;
> +    uint8_t *id, *settings, *text, *buf;
> +    int id_len, settings_len, text_len;
> +
> +    uint8_t *p = data;
> +    uint8_t *q = data + data_len;
> +
> +    if (p >= q)
> +        return AVERROR_INVALIDDATA;

if data_len can be negative then it should be checked directly
checking after adding it to a pointer could fail due to overflow


> +
> +    id = p;
> +    id_len = strcspn(p, "\r\n");

is it guranteed that the array is zero terminated ?


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130716/2a13edb5/attachment.asc>


More information about the ffmpeg-devel mailing list