[FFmpeg-devel] [PATCH] avcodec/pngdec: Check input space
Michael Niedermayer
michael at niedermayer.cc
Wed May 15 18:53:49 EEST 2019
On Tue, May 14, 2019 at 08:52:27PM +0100, Kieran Kunhya wrote:
> On Tue, 14 May 2019 at 20:42, Michael Niedermayer <michael at niedermayer.cc>
> wrote:
>
> > Fixes: Timeout (33sec -> 78ms)
> > Fixes:
> > 14668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-5767073352908800
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by
> > <https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by>:
> > Michael Niedermayer <michael at niedermayer.cc>
> > ---
> > libavcodec/pngdec.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> > index 6a681be29d..78988d9e75 100644
> > --- a/libavcodec/pngdec.c
> > +++ b/libavcodec/pngdec.c
> > @@ -1535,6 +1535,9 @@ static int decode_frame_lscr(AVCodecContext *avctx,
> > AVFrame *frame = data;
> > int ret, nb_blocks, offset = 0;
> >
> > + if (avpkt->size < 2)
> > + return AVERROR_INVALIDDATA;
> > +
> >
>
> Why not 1?
because the code reads 2 bytes next:
nb_blocks = bytestream2_get_le16(gb);
> Or maybe 3?
> Or maybe 42?
Its not checking for 3 or 42 or another number because the smallest
valid frame that our decoder accepts is 2 bytes.
In case you have a specification for LSCR, that would be interresting
to read to see if it contains more constraints which would lead to a
larger minimum size
Thanks
>
> Random numbers to fix random samples are just absurd.
>
> Kieran
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190515/39fea94f/attachment.sig>
More information about the ffmpeg-devel
mailing list