diff mbox

[FFmpeg-devel,2/4] avcodec/agm: Fix overflow of signed shift

Message ID 20190630221651.12795-2-michael@niedermayer.cc
State Accepted
Commit 6ebbfb377f7b6dcbf6a5c85b10109e838bd6e675
Headers show

Commit Message

Michael Niedermayer June 30, 2019, 10:16 p.m. UTC
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 15328/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5637545171353600

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

Comments

Michael Niedermayer July 19, 2019, 7:38 p.m. UTC | #1
On Mon, Jul 01, 2019 at 12:16:49AM +0200, Michael Niedermayer wrote:
> Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
> Fixes: 15328/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5637545171353600
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/agm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index a499c09082..2c4c9805e9 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -918,7 +918,7 @@  static void get_tree_codes(uint32_t *codes, Node *nodes, int idx, uint32_t pfx,
         codes[idx] = pfx;
     } else if (idx >= 0) {
         get_tree_codes(codes, nodes, nodes[idx].child[0], pfx + (0 << bitpos), bitpos + 1);
-        get_tree_codes(codes, nodes, nodes[idx].child[1], pfx + (1 << bitpos), bitpos + 1);
+        get_tree_codes(codes, nodes, nodes[idx].child[1], pfx + (1U << bitpos), bitpos + 1);
     }
 }