golomb: use HAVE_BITS_REMAINING() macro to prevent infloop on EOF.
authorRonald S. Bultje <rsbultje@gmail.com>
Fri, 17 Feb 2012 20:54:37 +0000 (12:54 -0800)
committerRonald S. Bultje <rsbultje@gmail.com>
Fri, 24 Feb 2012 15:28:33 +0000 (07:28 -0800)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/golomb.h

index 5f720c0..1712540 100644 (file)
@@ -135,7 +135,7 @@ static inline int svq3_get_ue_golomb(GetBitContext *gb){
             ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
             UPDATE_CACHE(re, gb);
             buf = GET_CACHE(re, gb);
-        } while (ret);
+        } while (HAVE_BITS_REMAINING(re, gb));
 
         CLOSE_READER(re, gb);
         return ret - 1;