Message ID | 20210208132902.6602-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 5552ceaf568915e668679f9581e07eb5507cafc4 |
Headers | show |
Series | [FFmpeg-devel,1/2] avformat/wtvdec: Check len in parse_chunks() to avoid overflow | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Mon, Feb 08, 2021 at 02:29:01PM +0100, Michael Niedermayer wrote: > Fixes: signed integer overflow: 2147483647 + 7 cannot be represented in type 'int' > Fixes: 30084/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6192261941559296 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/wtvdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c > index 6c41e3c1a3..7def9d2348 100644 > --- a/libavformat/wtvdec.c > +++ b/libavformat/wtvdec.c > @@ -794,7 +794,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p > > ff_get_guid(pb, &g); > len = avio_rl32(pb); > - if (len < 32) { > + if (len < 32 || len > INT_MAX - 7) { > int ret; > if (avio_feof(pb)) > return AVERROR_EOF; the + 7 comes from WTV_PAD calculation looks good -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
On Tue, Feb 09, 2021 at 02:20:41AM +1100, Peter Ross wrote: > On Mon, Feb 08, 2021 at 02:29:01PM +0100, Michael Niedermayer wrote: > > Fixes: signed integer overflow: 2147483647 + 7 cannot be represented in type 'int' > > Fixes: 30084/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6192261941559296 > > > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavformat/wtvdec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c > > index 6c41e3c1a3..7def9d2348 100644 > > --- a/libavformat/wtvdec.c > > +++ b/libavformat/wtvdec.c > > @@ -794,7 +794,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p > > > > ff_get_guid(pb, &g); > > len = avio_rl32(pb); > > - if (len < 32) { > > + if (len < 32 || len > INT_MAX - 7) { > > int ret; > > if (avio_feof(pb)) > > return AVERROR_EOF; > > the + 7 comes from WTV_PAD calculation yes > looks good will apply thx [...]
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 6c41e3c1a3..7def9d2348 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -794,7 +794,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p ff_get_guid(pb, &g); len = avio_rl32(pb); - if (len < 32) { + if (len < 32 || len > INT_MAX - 7) { int ret; if (avio_feof(pb)) return AVERROR_EOF;
Fixes: signed integer overflow: 2147483647 + 7 cannot be represented in type 'int' Fixes: 30084/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6192261941559296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/wtvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)