get_se_golomb: fix decoding of very large values
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 8 Feb 2013 23:43:30 +0000 (00:43 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Feb 2013 00:17:41 +0000 (01:17 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/golomb.h

index 9f82c74..66607ad 100644 (file)
@@ -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);