[theora-dev] AMD64 bug

Conrad Parker conrad at metadecks.org
Thu Aug 24 22:50:00 PDT 2006


applied, thanks.

Similar functions appear in other xiph.org codec libs; do similar errors
occur for eg. vorbis, speex?

cheers,

Conrad.

On Thu, Aug 24, 2006 at 11:10:20PM +0200, Peter De Wachter wrote:
> The theora_unpack_comment casts a pointer-to-int to pointer-to-long. This
> is incorrect on AMD64, where ints and longs are of different size. On my
> system (Debian unstable, gcc 4.1) this causes players to crash when they
> reach the end of a movie. The patch below fixes this bug.
> 
> 
> --- libtheora-0.0.0.alpha7/lib/toplevel.c	2006-06-13 00:57:36.000000000 +0200
> +++ libtheora-pdw/lib/toplevel.c	2006-08-19 16:55:30.000000000 +0200
> @@ -172,7 +172,7 @@
>  
>  static int _theora_unpack_comment(theora_comment *tc, oggpack_buffer *opb){
>    int i;
> -  long len;
> +  long len,tmp;
>  
>     _tp_readlsbint(opb,&len);
>    if(len<0)return(OC_BADHEADER);
> @@ -180,7 +180,8 @@
>    _tp_readbuffer(opb,tc->vendor, len);
>    tc->vendor[len]='\0';
>  
> -  _tp_readlsbint(opb,(long *) &tc->comments);
> +  _tp_readlsbint(opb,&tmp);
> +  tc->comments=tmp;
>    if(tc->comments<0)goto parse_err;
>    tc->user_comments=_ogg_calloc(tc->comments,sizeof(*tc->user_comments));
>    tc->comment_lengths=_ogg_calloc(tc->comments,sizeof(*tc->comment_lengths));
> _______________________________________________
> theora-dev mailing list
> theora-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/theora-dev


More information about the theora-dev mailing list