[FFmpeg-devel] [PATCH] avformat/icodec: fix integer overflow with nb_pal

Michael Niedermayer michael at niedermayer.cc
Mon Nov 25 04:03:26 EET 2024


On Sun, Nov 24, 2024 at 09:06:16PM +1100, Peter Ross wrote:
> On Thu, Nov 21, 2024 at 03:39:05PM +0100, Kacper Michajlow wrote:
> > On Sun, 3 Nov 2024 at 11:24, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > >
> > > Fixes: runtime error: signed integer overflow
> > > Fixes: 42536949/clusterfuzz-testcase-minimized-fuzzer_loadfile-6199846684393472
> > > Found-by: ossfuzz
> > > Reported-by: Kacper Michajlow
> > > Tested-by: Kacper Michajlow
> > > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > > ---
> > >  libavformat/icodec.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/libavformat/icodec.c b/libavformat/icodec.c
> > > index afd0c71b1f9..b09d0060a65 100644
> > > --- a/libavformat/icodec.c
> > > +++ b/libavformat/icodec.c
> > > @@ -198,7 +198,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
> > >              AV_WL32(buf + 32, image->nb_pal);
> > >          }
> > >
> > > -        if (image->nb_pal > INT_MAX / 4 - 14 - 40)
> > > +        if (image->nb_pal > INT_MAX / 4 - 14 - 40U)
> > >              return AVERROR_INVALIDDATA;
> > >
> > >          AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
> > > --
> > > 2.47.0
> 
> as the original author of icodec.c, this lgtm

will apply

thx

[...]

-- 
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: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241125/22a63db5/attachment.sig>


More information about the ffmpeg-devel mailing list