diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-22 03:12:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-22 03:16:52 +0200 |
commit | 53f04424646d8f5cbac915717f2604ad516b4881 (patch) | |
tree | 12fbf75bef967f63a874bdbae6d5291f095d699f /libavcodec | |
parent | 73ffab41959a17650d552dceefbb11e524a430d4 (diff) | |
download | ffmpeg-streaming-53f04424646d8f5cbac915717f2604ad516b4881.zip ffmpeg-streaming-53f04424646d8f5cbac915717f2604ad516b4881.tar.gz |
avcodec/jpeg2000dec: Port tile size check from j2kdec
Fixes potential integer overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/jpeg2000dec.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 125aacd..a43cc7e 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -192,6 +192,9 @@ static int get_siz(Jpeg2000DecoderContext *s) s->numXtiles = ff_jpeg2000_ceildiv(s->width - s->tile_offset_x, s->tile_width); s->numYtiles = ff_jpeg2000_ceildiv(s->height - s->tile_offset_y, s->tile_height); + if(s->numXtiles * (uint64_t)s->numYtiles > INT_MAX/sizeof(Jpeg2000Tile)) + return AVERROR(EINVAL); + s->tile = av_mallocz(s->numXtiles * s->numYtiles * sizeof(*s->tile)); if (!s->tile) return AVERROR(ENOMEM); |