[FFmpeg-devel] [PATCH 2/3] ffmdec: cast state to unsigned for left shift

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Jan 2 16:51:57 CET 2016


This fixes ubsan runtime error: left shift by 8 places cannot be
represented in type 'int'

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/ffmdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 7b2d0d7..3162354 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -76,7 +76,7 @@ static int ffm_resync(AVFormatContext *s, int state)
             av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
             return -1;
         }
-        state = (state << 8) | avio_r8(s->pb);
+        state = ((unsigned)state << 8) | avio_r8(s->pb);
     }
     return 0;
 }
-- 
2.6.4



More information about the ffmpeg-devel mailing list