From a92816c4eb9db66e91e6f3ecdb2f5c13225e30f1 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Sat, 9 Feb 2013 00:43:30 +0100
Subject: [PATCH] get_se_golomb: fix decoding of very large values

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavcodec/golomb.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 9f82c741814..66607ada21e 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -187,7 +187,11 @@ static inline int get_se_golomb(GetBitContext *gb){
 
         return ff_se_golomb_vlc_code[buf];
     }else{
-        log= 2*av_log2(buf) - 31;
+        log = av_log2(buf);
+        LAST_SKIP_BITS(re, gb, 31 - log);
+        UPDATE_CACHE(re, gb);
+        buf = GET_CACHE(re, gb);
+
         buf>>= log;
 
         LAST_SKIP_BITS(re, gb, 32 - log);
-- 
GitLab