[Ffmpeg-devel] ffplay broken in latest svn

Wolfram Gloger wmglo
Tue Jan 9 13:35:57 CET 2007

> >> -    double duration_error[MAX_STREAMS][MAX_STD_TIMEBASES]={{0}}; //FIXME malloc()?
> >> +    double (*duration_error)[MAX_STD_TIMEBASES] = av_mallocz(MAX_STREAMS * MAX_STD_TIMEBASES * sizeof(duration_error));
> >
> >Ahem, this, without any further pointer initialization, cannot
> >possibly be correct, the first duration_error[i][j] dereference will
> >crash, also I think the sizeof(duration_error) (==
> >MAX_STD_TIME_BASES*sizeof(double*) in this case) is probably
> >unintentionally large..
> sizeof(duration_error) != MAX_STD_TIME_BASES*sizeof(double*)
> sizeof(duration_error) == sizeof(double*)

You're basically right here (discounting possible but improbable size
difference between "pointer to array" and "pointer to first element";
I missed the indirection), but that is _even worse_ as usually

> Infact, it seems possibly correct ;]
> http://c-faq.com/aryptr/dynmuldimary.html

..but then you would have to change the declaration to

double (*duration_error)[MAX_STREAMS][MAX_STD_TIMEBASES] = ...;

and _every single access_ to (*duration_error)[i][j] which your patch
certainly didn't do.

I stand by my claim that the patch is obviously incorrect.


More information about the ffmpeg-devel mailing list