Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Grunau <janne-vlc@jannau.net>2018-10-02 22:16:16 +0300
committerJanne Grunau <janne-vlc@jannau.net>2018-10-03 16:31:26 +0300
commita537c5acd9c4bd3b37c83b5783b3f3414fdf907a (patch)
tree975a70682a61c1a6750c4d26ede7d7b3f1212a39
parent4ec4605bd06d42d057ea5014c08fd09b388c2d97 (diff)
get_bits: avoid infinite loops in get_vlc() at EOF
Fixes a fuzzing time out with timeout-e372a93d3be3f703bb7a49ce3d92c72d06f3b9cb.
-rw-r--r--src/getbits.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/getbits.c b/src/getbits.c
index 9eb0759..9ce629d 100644
--- a/src/getbits.c
+++ b/src/getbits.c
@@ -89,8 +89,9 @@ unsigned get_uniform(GetBits *const c, const unsigned n) {
unsigned get_vlc(GetBits *const c) {
int n_bits = 0;
- while (!get_bits(c, 1)) n_bits++;
- if (n_bits >= 32) return 0xFFFFFFFFU;
+ while (!get_bits(c, 1))
+ if (++n_bits == 32)
+ return 0xFFFFFFFFU;
return ((1 << n_bits) - 1) + get_bits(c, n_bits);
}