diff mbox

[FFmpeg-devel,2/2] avcodec/ylc: Fix shift overflow

Message ID 20170722023524.23333-2-michael@niedermayer.cc
State Accepted
Commit 03a9e6ff303ad82e75b734edbe4917ca5fd60159
Headers show

Commit Message

Michael Niedermayer July 22, 2017, 2:35 a.m. UTC
Fixes: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 2698/clusterfuzz-testcase-minimized-4713541443518464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ylc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer July 24, 2017, 3:35 p.m. UTC | #1
On Sat, Jul 22, 2017 at 04:35:24AM +0200, Michael Niedermayer wrote:
> Fixes: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
> Fixes: 2698/clusterfuzz-testcase-minimized-4713541443518464
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ylc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c
index ae46b3b8c2..11333222b9 100644
--- a/libavcodec/ylc.c
+++ b/libavcodec/ylc.c
@@ -69,7 +69,7 @@  static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
 
     s = nodes[node].sym;
     if (s != -1) {
-        bits[*pos] = (~pfx) & ((1U << FFMAX(pl, 1)) - 1);
+        bits[*pos] = (~pfx) & ((1ULL << FFMAX(pl, 1)) - 1);
         lens[*pos] = FFMAX(pl, 1);
         xlat[*pos] = s + (pl == 0);
         (*pos)++;