Message ID | 20190612232020.25959-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 5ea7f2050050fd6a9177a9b618f2bb2d4add9230 |
Headers | show |
On Thu, Jun 13, 2019 at 01:20:19AM +0200, Michael Niedermayer wrote: > Fixes: left shift of negative value -14614752 > Fixes: 15174/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5670543606415360 > > 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 | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c > index 890db2e705..706e8ca38d 100644 > --- a/libavformat/wtvdec.c > +++ b/libavformat/wtvdec.c > @@ -149,7 +149,7 @@ static int read_ints(AVIOContext *pb, uint32_t *data, int count) > * @param depth File allocation table depth > * @return NULL on error > */ > -static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) > +static AVIOContext * wtvfile_open_sector(unsigned first_sector, uint64_t length, int depth, AVFormatContext *s) > { > AVIOContext *pb; > WtvFile *wf; > @@ -957,7 +957,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p > static int read_header(AVFormatContext *s) > { > WtvContext *wtv = s->priv_data; > - int root_sector, root_size; > + unsigned root_sector; > + int root_size; > uint8_t root[WTV_SECTOR_SIZE]; > AVIOContext *pb; > int64_t timeline_pos; ok, i see how that can happen on 32-bit. please push. -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
On Thu, Jun 13, 2019 at 10:27:00PM +1000, Peter Ross wrote: > On Thu, Jun 13, 2019 at 01:20:19AM +0200, Michael Niedermayer wrote: > > Fixes: left shift of negative value -14614752 > > Fixes: 15174/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5670543606415360 > > > > 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 | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c > > index 890db2e705..706e8ca38d 100644 > > --- a/libavformat/wtvdec.c > > +++ b/libavformat/wtvdec.c > > @@ -149,7 +149,7 @@ static int read_ints(AVIOContext *pb, uint32_t *data, int count) > > * @param depth File allocation table depth > > * @return NULL on error > > */ > > -static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) > > +static AVIOContext * wtvfile_open_sector(unsigned first_sector, uint64_t length, int depth, AVFormatContext *s) > > { > > AVIOContext *pb; > > WtvFile *wf; > > @@ -957,7 +957,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p > > static int read_header(AVFormatContext *s) > > { > > WtvContext *wtv = s->priv_data; > > - int root_sector, root_size; > > + unsigned root_sector; > > + int root_size; > > uint8_t root[WTV_SECTOR_SIZE]; > > AVIOContext *pb; > > int64_t timeline_pos; > > ok, i see how that can happen on 32-bit. > please push. will apply thx [...]
On Thu, Jun 13, 2019 at 01:20:17AM +0200, Michael Niedermayer wrote: > Fixes: Integer overflow > Fixes: 15134/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_fuzzer-5722635939348480 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/xpmdec.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) will apply [...]
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 43dd9bc7e7..922dfc0f67 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -311,6 +311,7 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, int ncolors, cpp, ret, i, j; int64_t size; uint32_t *dst; + int width, height; avctx->pix_fmt = AV_PIX_FMT_BGRA; @@ -332,12 +333,12 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, ptr += mod_strcspn(ptr, "\""); if (sscanf(ptr, "\"%u %u %u %u\",", - &avctx->width, &avctx->height, &ncolors, &cpp) != 4) { + &width, &height, &ncolors, &cpp) != 4) { av_log(avctx, AV_LOG_ERROR, "missing image parameters\n"); return AVERROR_INVALIDDATA; } - if ((ret = ff_set_dimensions(avctx, avctx->width, avctx->height)) < 0) + if ((ret = ff_set_dimensions(avctx, width, height)) < 0) return ret; if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
Fixes: Integer overflow Fixes: 15134/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_fuzzer-5722635939348480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/xpmdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)