summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-15 20:03:39 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-15 20:53:22 +0100
commit016fd413f9168816924f21c0c1ffb578f7226221 (patch)
treea355187fc51e843f9fd10db35ee2c902204f12ac /libavcodec/jpeg2000.c
parenta01046c90c9a8ace6105fcef6cd7964edae62357 (diff)
downloadffmpeg-016fd413f9168816924f21c0c1ffb578f7226221.tar.gz
avcodec/jpeg2000: Use av_image_check_size() in ff_jpeg2000_init_component()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/jpeg2000.c')
-rw-r--r--libavcodec/jpeg2000.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index d9869fd277..a1ef396c95 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -28,6 +28,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
+#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "jpeg2000.h"
@@ -461,7 +462,10 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
codsty->nreslevels2decode - 1,
codsty->transform))
return ret;
- // component size comp->coord is uint16_t so ir cannot overflow
+
+ if (av_image_check_size(comp->coord[0][1] - comp->coord[0][0],
+ comp->coord[1][1] - comp->coord[1][0], 0, avctx))
+ return AVERROR_INVALIDDATA;
csize = (comp->coord[0][1] - comp->coord[0][0]) *
(comp->coord[1][1] - comp->coord[1][0]);