aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-24 04:59:25 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-24 18:42:55 +0100
commit628c9dcca3fb3f46f960f0df8236591653c6e512 (patch)
treef570039f75bd256b26d8fda048294d0c90336e21
parent58c41799ab6b52df86b6afe23304f34b62741326 (diff)
downloadffmpeg-628c9dcca3fb3f46f960f0df8236591653c6e512.tar.gz
j2kdec: fix division by zero, check tile dimensions for validity
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/j2kdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c
index 1f4acc53fd..a8c0c52c25 100644
--- a/libavcodec/j2kdec.c
+++ b/libavcodec/j2kdec.c
@@ -220,6 +220,9 @@ static int get_siz(J2kDecoderContext *s)
s->tile_offset_y = bytestream_get_be32(&s->buf); // YT0Siz
s->ncomponents = bytestream_get_be16(&s->buf); // CSiz
+ if(s->tile_width<=0 || s->tile_height<=0)
+ return AVERROR(EINVAL);
+
if (s->buf_end - s->buf < 2 * s->ncomponents)
return AVERROR(EINVAL);