[FFmpeg-cvslog] aacdec: fix signed overflows in lcg_random()

Mans Rullgard git at videolan.org
Tue Nov 27 13:47:06 CET 2012


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Nov 24 13:12:47 2012 +0000| [edd80ec7e32b097043432fa67281ed8c6d044331] | committer: Mans Rullgard

aacdec: fix signed overflows in lcg_random()

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=edd80ec7e32b097043432fa67281ed8c6d044331
---

 libavcodec/aacdec.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index d2a31ca..af17acf 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -787,7 +787,8 @@ static int decode_audio_specific_config(AACContext *ac,
  */
 static av_always_inline int lcg_random(int previous_val)
 {
-    return previous_val * 1664525 + 1013904223;
+    union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 };
+    return v.s;
 }
 
 static av_always_inline void reset_predict_state(PredictorState *ps)



More information about the ffmpeg-cvslog mailing list