[FFmpeg-devel] [PATCH] h264/aac in flv

Michael Niedermayer michaelni
Mon May 5 16:50:39 CEST 2008


On Mon, May 05, 2008 at 03:54:29PM +0200, Baptiste Coudurier wrote:
> Hi guys,
> 
> $subject, 2 patches, I'll commit pts/dts renaming seperately.
> 
> Specs: http://www.adobe.com/devnet/flv/
[...]
> +static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
> +{
> +    av_free(st->codec->extradata);
> +    st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);

I think the addition can overflow


> +    if (!st->codec->extradata)
> +        return AVERROR(ENOMEM);
> +    st->codec->extradata_size = size;
> +    get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
> +    return 0;
> +}

[...]
> +            if (type == 0) {
> +                if ((ret = flv_get_extradata(s, st, size - 1)) < 0)
> +                    return ret;
> +                goto retry;
> +            }
> +        }
>      }else{
>          size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
> +        if (st->codec->codec_id == CODEC_ID_H264) {
> +            int type = get_byte(s->pb);
> +            pkt->pts = dts + get_be24(s->pb);

> +            if (type == 0) {
> +                if ((ret = flv_get_extradata(s, st, size - 1)) < 0)
> +                    return ret;
> +                goto retry;
> +            }

code duplication

[....]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080505/f8a3f89a/attachment.pgp>



More information about the ffmpeg-devel mailing list