diff mbox

[FFmpeg-devel,2/2] avcodec/hevcdsp_template.c: Fix undefined shift in FUNC(dequant)

Message ID 20171222025242.7703-2-michael@niedermayer.cc
State Accepted
Commit 0c9ab5ef9c1ee852c80c859c9e07efe8730b57ed
Headers show

Commit Message

Michael Niedermayer Dec. 22, 2017, 2:52 a.m. UTC
Fixes: runtime error: left shift of negative value -180
Fixes: 4626/clusterfuzz-testcase-minimized-5647837887987712

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

Patch

diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
index 4017af8eb0..903aa3fe95 100644
--- a/libavcodec/hevcdsp_template.c
+++ b/libavcodec/hevcdsp_template.c
@@ -121,7 +121,7 @@  static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size)
     } else {
         for (y = 0; y < size; y++) {
             for (x = 0; x < size; x++) {
-                *coeffs = *coeffs << -shift;
+                *coeffs = *(uint16_t*)coeffs << -shift;
                 coeffs++;
             }
         }