diff mbox

[FFmpeg-devel] avcodec/tiff: do not allow bpp 40 with undefined pixel formats

Message ID 20190323181604.19920-1-michael@niedermayer.cc
State Accepted
Commit 013f71497ba51e8381a6a4521b9279ed502e7077
Headers show

Commit Message

Michael Niedermayer March 23, 2019, 6:16 p.m. UTC
Fixes: Out of array access, assertion failure
Fixes: 13851/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5754570929602560
Fixes: 13869/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5695998313103360
Fixes: 13873/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5077273645940736
Fixes: 13874/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5756396757319680
Fixes: 13877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5741026750234624
Fixes: 13880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5649148809838592

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

Comments

Carl Eugen Hoyos March 23, 2019, 10:29 p.m. UTC | #1
2019-03-23 19:16 GMT+01:00, Michael Niedermayer <michael@niedermayer.cc>:
> Fixes: Out of array access, assertion failure
> Fixes:
> 13851/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5754570929602560
> Fixes:
> 13869/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5695998313103360
> Fixes:
> 13873/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5077273645940736
> Fixes:
> 13874/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5756396757319680
> Fixes:
> 13877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5741026750234624
> Fixes:
> 13880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5649148809838592
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/tiff.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 29a80a6892..3130eb8048 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -830,6 +830,11 @@ static int init_image(TiffContext *s, ThreadFrame
> *frame)
>      case 405:
>          if (s->photometric == TIFF_PHOTOMETRIC_SEPARATED)
>              s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
> +        else {
> +            av_log(s->avctx, AV_LOG_ERROR,
> +                "bpp=40 without PHOTOMETRIC_SEPARATED is unsupported\n");
> +            return AVERROR_PATCHWELCOME;

Lgtm, thank you!

Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 29a80a6892..3130eb8048 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -830,6 +830,11 @@  static int init_image(TiffContext *s, ThreadFrame *frame)
     case 405:
         if (s->photometric == TIFF_PHOTOMETRIC_SEPARATED)
             s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
+        else {
+            av_log(s->avctx, AV_LOG_ERROR,
+                "bpp=40 without PHOTOMETRIC_SEPARATED is unsupported\n");
+            return AVERROR_PATCHWELCOME;
+        }
         break;
     case 483:
         s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGB48LE  : AV_PIX_FMT_RGB48BE;