diff mbox series

[FFmpeg-devel] avcodec/tiff: Check stride for dng

Message ID 20200614221014.2965-1-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/tiff: Check stride for dng
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer June 14, 2020, 10:10 p.m. UTC
Fixes: assertion failure
Fixes: 23422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5746026064642048

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 | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Limin Wang June 15, 2020, 1:08 a.m. UTC | #1
On Mon, Jun 15, 2020 at 12:10:14AM +0200, Michael Niedermayer wrote:
> Fixes: assertion failure
> Fixes: 23422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5746026064642048
> 
> 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 | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 010943c38c..26a936074f 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -679,6 +679,10 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
>          return 0;
>      }
>  
> +    if (is_dng && stride == 0)
> +        return AVERROR_INVALIDDATA;
> +
> +

why add two blank line here?

>      for (line = 0; line < lines; line++) {
>          if (src - ssrc > size) {
>              av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n");
> -- 
> 2.17.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer June 15, 2020, 5:22 p.m. UTC | #2
On Mon, Jun 15, 2020 at 09:08:21AM +0800, lance.lmwang@gmail.com wrote:
> On Mon, Jun 15, 2020 at 12:10:14AM +0200, Michael Niedermayer wrote:
> > Fixes: assertion failure
> > Fixes: 23422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5746026064642048
> > 
> > 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 | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> > index 010943c38c..26a936074f 100644
> > --- a/libavcodec/tiff.c
> > +++ b/libavcodec/tiff.c
> > @@ -679,6 +679,10 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
> >          return 0;
> >      }
> >  
> > +    if (is_dng && stride == 0)
> > +        return AVERROR_INVALIDDATA;
> > +
> > +
> 
> why add two blank line here?

that was unintended
will apply without the extra blank line,

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 010943c38c..26a936074f 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -679,6 +679,10 @@  static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
         return 0;
     }
 
+    if (is_dng && stride == 0)
+        return AVERROR_INVALIDDATA;
+
+
     for (line = 0; line < lines; line++) {
         if (src - ssrc > size) {
             av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n");