[MPlayer-dev-eng] [PATCH] Fix int wrap around in af_gcd from /libaf/af.c

Uoti Urpala uoti.urpala at pp1.inet.fi
Mon Sep 18 16:05:51 CEST 2006


On Sat, 2006-09-16 at 14:22 +0200, Ahmet İnan wrote:
> i was wondering, why "-af resample=9600:0:2" worked from 44100hz files, but
> always failed from 48000hz files.

I suppose you meant 96000 instead of 9600 above.

> it turned out to be a problem in "af_gcd" from "/libaf/af.c", where:
> 
> "if (a * b_org < 0)"
> 
> would be fine, as long as the multiplication wouldnt leave the limits of "int".
> it does for 48000 * 96000 tho. so ive come up with this solution:
> 
> "if (a < 0 && b_org > 0 || a > 0 && b_org < 0)"
> 
> im sure, there are more elegant and better ways for this, but currently, this
> solves it for me. it would be nice to have this in the next release included.

The function doesn't seem to be used for negative values, so I just
removed the buggy test.




More information about the MPlayer-dev-eng mailing list