[FFmpeg-devel] [PATCH 1/2] avcodec/notchlc: Check uncompressed size against input for LZ4

Michael Niedermayer michael at niedermayer.cc
Wed Oct 14 22:17:40 EEST 2020


On Wed, Oct 14, 2020 at 07:54:34PM +0200, Paul B Mahol wrote:
> On Wed, Oct 14, 2020 at 05:53:07PM +0200, Michael Niedermayer wrote:
> > Fixes: OOM
> > Fixes: 26168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-6019839015256064
> > 
> > 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/notchlc.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
> > index 3f7079da70..0254e7d76a 100644
> > --- a/libavcodec/notchlc.c
> > +++ b/libavcodec/notchlc.c
> > @@ -490,6 +490,9 @@ static int decode_frame(AVCodecContext *avctx,
> >  
> >          bytestream2_init(gb, s->lzf_buffer, uncompressed_size);
> >      } else if (s->format == 1) {
> > +        if (bytestream2_get_bytes_left(gb) < uncompressed_size / 255)
> 
> From where you picked this division? And expecially 255 number?

from a look at lz4_decompress(), it appeared to me that the amount
of bytes output is encoded so that each 255 bytes output require a byte
input. So the output would be bound to 255 times the input size
Did i miss something ?

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20201014/8c5f89ca/attachment.sig>


More information about the ffmpeg-devel mailing list