[FFmpeg-devel] [PATCH] avcodec/cfhd: Check transform type

Michael Niedermayer michael at niedermayer.cc
Fri Aug 28 02:06:09 EEST 2020


Fixes: out of array access
Fixes: 24823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4855119863349248

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

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 291d53e02e..be06b184de 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -486,7 +486,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
             s->sample_type = data;
             av_log(avctx, AV_LOG_DEBUG, "Sample type? %"PRIu16"\n", data);
         } else if (tag == TransformType) {
-            if (data > 2) {
+            if (data != 0 && data != 2) {
                 av_log(avctx, AV_LOG_ERROR, "Invalid transform type\n");
                 ret = AVERROR(EINVAL);
                 break;
-- 
2.17.1



More information about the ffmpeg-devel mailing list