[FFmpeg-cvslog] golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls( )
Justin Ruggles
git at videolan.org
Tue Oct 16 16:36:05 CEST 2012
ffmpeg | branch: release/0.10 | Justin Ruggles <justin.ruggles at gmail.com> | Mon Jun 11 10:29:57 2012 -0400| [d9ffa2aca1e438a44d41f3ef3aeb8ef396bcd7b0] | committer: Anton Khirnov
golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls()
Fixes infinite loop in FLAC decoding in case of a truncated bitstream due to
the safe bitstream reader returning 0's at the end.
Fixes Bug 310.
CC:libav-stable at libav.org
(cherry picked from commit 4795362660a526a38a7a60f06826bce97a092b59)
Signed-off-by: Anton Khirnov <anton at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9ffa2aca1e438a44d41f3ef3aeb8ef396bcd7b0
---
libavcodec/golomb.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 1712540..b6b8cc8 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -301,7 +301,7 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int
return buf;
}else{
int i;
- for (i = 0; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) {
+ for (i = 0; i < limit && SHOW_UBITS(re, gb, 1) == 0 && HAVE_BITS_REMAINING(re, gb); i++) {
LAST_SKIP_BITS(re, gb, 1);
UPDATE_CACHE(re, gb);
}
More information about the ffmpeg-cvslog
mailing list