summaryrefslogtreecommitdiff
path: root/libavcodec/golomb.h
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-06-11 10:29:57 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-06-12 14:33:39 -0400
commit4795362660a526a38a7a60f06826bce97a092b59 (patch)
tree55226412f7fb4d3570469478ccbe7ec955519d3a /libavcodec/golomb.h
parent404410a53ac9490d2c74369f7aab18afcc578bc3 (diff)
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@libav.org
Diffstat (limited to 'libavcodec/golomb.h')
-rw-r--r--libavcodec/golomb.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 1712540fd3..b6b8cc8412 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);
}