[MPlayer-dev-eng] [PATCH] Fix int wrap around in af_gcd from /libaf/af.c
Ahmet İnan
mplayer at ainan.org
Sat Sep 16 14:22:36 CEST 2006
i was wondering, why "-af resample=9600:0:2" worked from 44100hz files, but
always failed from 48000hz files.
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.
ahmet
-------------- next part --------------
--- MPlayer-1.0pre8/libaf/af.c.orig 2006-09-16 00:20:49.564289784 +0200
+++ MPlayer-1.0pre8/libaf/af.c 2006-09-16 00:27:59.001815609 +0200
@@ -665,7 +665,7 @@
a += b;
if (!a)
return 1;
- if (a * b_org < 0)
+ if (a < 0 && b_org > 0 || a > 0 && b_org < 0)
return -a;
return a;
}
More information about the MPlayer-dev-eng
mailing list