Message ID | 20220917211557.11547-8-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | db73ae0dc114aa6fae08e69f977944f056a24995 |
Headers | show |
Series | [FFmpeg-devel,1/9] avformat/ape: Check frames size | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Sat, Sep 17, 2022 at 11:15:56PM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 538976288 * 4 cannot be represented in type 'int' > Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-6690068904935424 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/icodec.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavformat/icodec.c b/libavformat/icodec.c > index 290f658d0c0..85dab3bca0a 100644 > --- a/libavformat/icodec.c > +++ b/libavformat/icodec.c > @@ -196,6 +196,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) > AV_WL32(buf + 32, image->nb_pal); > } > > + if (image->nb_pal > INT_MAX / 4 - 14 - 40) > + return AVERROR_INVALIDDATA; > + > AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4); > AV_WL32(buf + 8, AV_RL32(buf + 8) / 2); > } > -- > 2.17.1 lgtm, please apply -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
diff --git a/libavformat/icodec.c b/libavformat/icodec.c index 290f658d0c0..85dab3bca0a 100644 --- a/libavformat/icodec.c +++ b/libavformat/icodec.c @@ -196,6 +196,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AV_WL32(buf + 32, image->nb_pal); } + if (image->nb_pal > INT_MAX / 4 - 14 - 40) + return AVERROR_INVALIDDATA; + AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4); AV_WL32(buf + 8, AV_RL32(buf + 8) / 2); }
Fixes: signed integer overflow: 538976288 * 4 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-6690068904935424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/icodec.c | 3 +++ 1 file changed, 3 insertions(+)