diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-01 10:00:59 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-07-02 20:05:43 +0200 |
commit | fbcc03db8f3919e2ea46d6ad11a00906b1c0ef0e (patch) | |
tree | 13d2965a981e49ae2e8f0cc464be63d8c7640b28 /libavcodec | |
parent | 5650e331a733711b809bc27f968500f0f5530126 (diff) | |
download | ffmpeg-fbcc03db8f3919e2ea46d6ad11a00906b1c0ef0e.tar.gz |
jpeg2000: Check code-block size
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Nicolas Bertrand <nicoinattendu@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/jpeg2000dec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index e29f73162b..8fbe3493ef 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -267,6 +267,12 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; // cblk width c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height + if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 || + c->log2_cblk_width + c->log2_cblk_height > 12) { + av_log(s->avctx, AV_LOG_ERROR, "cblk size invalid\n"); + return AVERROR_INVALIDDATA; + } + c->cblk_style = bytestream_get_byte(&s->buf); if (c->cblk_style != 0) { // cblk style av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n"); |