[FFmpeg-devel] [PATCH] mov demuxer crashes on certain .jp2 files

Benoit Fouet benoit.fouet
Tue Dec 16 08:49:36 CET 2008


On 12/16/2008 07:06 AM, Jai Menon wrote:
> Hi,
>
> On Tue, Dec 16, 2008 at 11:31 AM, Jai Menon <jmenon86 at gmail.com> wrote:
>   
>> Hi,
>>
>> The mov demuxer segfaults when parsing certain .jp2 files found at :
>>
>> http://samples.mplayerhq.hu/jpeg2000/j2kp4files_v1_2.zip/testfiles_jp2/*.jp2
>>
>> Attached patch fixes this issue.
>>
>>     
>  and obviously I forgot the patch :-)
>
>
>   

> Index: libavformat/mov.c
> ===================================================================
> --- libavformat/mov.c	(revision 16141)
> +++ libavformat/mov.c	(working copy)
> @@ -599,7 +599,11 @@
>  /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */
>  static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
>  {
> -    AVStream *st = c->fc->streams[c->fc->nb_streams-1];
> +    AVStream *st;
> +    if(c->fc->nb_streams >= 1)
> +        st = c->fc->streams[c->fc->nb_streams-1];
> +    else
> +        return -1;
>      uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;
>      uint8_t *buf;

this mixes declaration and code

Ben






More information about the ffmpeg-devel mailing list