[Ffmpeg-devel] [Ffmpeg-devel-old] Division by 0 in av_frac_add()
Tue Oct 4 18:11:32 CEST 2005
On 10/3/05, Nico Sabbi <nsabbi at tiscali.it> wrote:
> 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:
> 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
> 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.
Attached is the fix Nico suggested.
Somehow, I think this fix should feature some code that assigns
"f->val" and "f->num" with some values but I don't know what...
Reading doesn't hurt, really!
-- Dominik 'Rathann' Mierzejewski
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 541 bytes
Desc: not available
More information about the ffmpeg-devel