summaryrefslogtreecommitdiff
path: root/third_party/libopenjpeg20/tcd.c
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-12-15 11:51:06 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-12-15 11:51:06 +0800
commite8200e94898f7e8f50c11bb8b7b39d96b01bd653 (patch)
treebf27cfcefca12e4eb3cc7de5d2cf09a4d0386a12 /third_party/libopenjpeg20/tcd.c
parent4d4c61ea4e39135b126879dd6d7bc99a59a3a843 (diff)
downloadpdfium-e8200e94898f7e8f50c11bb8b7b39d96b01bd653.tar.xz
Fix a dividing zero bug in opj_tcd_init_tile()
BUG=541446 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1520203002 .
Diffstat (limited to 'third_party/libopenjpeg20/tcd.c')
-rw-r--r--third_party/libopenjpeg20/tcd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/third_party/libopenjpeg20/tcd.c b/third_party/libopenjpeg20/tcd.c
index 2fccff1c9c..aebe9be96c 100644
--- a/third_party/libopenjpeg20/tcd.c
+++ b/third_party/libopenjpeg20/tcd.c
@@ -727,7 +727,10 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_comp->dx);
l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_comp->dy);
/*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/
-
+ if (l_tilec->x0 >= l_tilec->x1 || l_tilec->y0 >= l_tilec->y1) {
+ opj_event_msg(manager, EVT_ERROR, "Invalid tile data\n");
+ return OPJ_FALSE;
+ }
/* compute l_data_size with overflow check */
l_data_size = (OPJ_UINT32)(l_tilec->x1 - l_tilec->x0);
if ((((OPJ_UINT32)-1) / l_data_size) < (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0)) {