avcodec/g2meet: Check RGB upper limit
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 27 Apr 2018 18:16:13 +0000 (20:16 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 17 May 2018 00:23:06 +0000 (02:23 +0200)
Fixes: runtime error: left shift of 1876744317 by 16 places cannot be represented in type 'int'
Fixes: 6799/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5115274731716608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/g2meet.c

index 5edfb31..2cf708a 100644 (file)
@@ -556,7 +556,7 @@ static uint32_t epic_decode_pixel_pred(ePICContext *dc, int x, int y,
         B     = ((pred >> B_shift) & 0xFF) - TOSIGNED(delta);
     }
 
-    if (R<0 || G<0 || B<0) {
+    if (R<0 || G<0 || B<0 || R > 255 || G > 255 || B > 255) {
         av_log(NULL, AV_LOG_ERROR, "RGB %d %d %d is out of range\n", R, G, B);
         return 0;
     }