From 13b6729361d45b9f308d731dd6b82dac01428dc3 Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Sat, 24 May 2008 16:38:48 +0000 Subject: [PATCH] Use an intermediate variable for overflow testing Originally committed as revision 13283 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ra144.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c index 5cfe94f25e..d4dc47733c 100644 --- a/libavcodec/ra144.c +++ b/libavcodec/ra144.c @@ -154,19 +154,22 @@ static void final(const short *i1, const short *i2, for (i=0; i>= 12; - if (ptr[10] - sum < -32768 || ptr[10] - sum > 32767) { + new_val = ptr[10] - sum; + + if (new_val < -32768 || new_val > 32767) { memset(out, 0, len * 2); memset(statbuf, 0, 20); return; } - ptr[10] -= sum; + ptr[10] = new_val; ptr++; }