[Ffmpeg-devel] [Ffmpeg-devel-old] Division by 0 in av_frac_add()
Nico Sabbi
nsabbi
Mon Oct 3 22:57:58 CEST 2005
Hi,
av_frad_add() doesn't check that f->den != 0; this leads to SIGFPE.
debugging a part of mencoder that recently crashes, and comparing it
with the last
working revision, I discovered what follows:
assigning:
AVCodecContext *ctx;
ctx->width = stream->bih->biWidth;
ctx->height = stream->bih->biHeight;
when ctx->width = ctx->height = 0 (non-sense but unfortunately true)
and soon after calling av_write_header() mencoder dies with SIGFPE because
av_frac_add() assigns:
f->val += num / den; with den==0.
The same code in mencoder, although buggy, worked without problems in
1.0pre7.
Adding
if(!den) return;
on top av_frac_add() fixes the code; I don't know if it's the right
solution, but preventing
an invalid operation sounds reasonable in any case.
Nico
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Ffmpeg-devel mailing list
Ffmpeg-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list