diff options
| author | mayeut <mayeut@users.noreply.github.com> | 2016-05-08 18:40:12 +0200 |
|---|---|---|
| committer | mayeut <mayeut@users.noreply.github.com> | 2016-05-08 18:40:12 +0200 |
| commit | 8f9cc62b3f9a1da9712329ddcedb9750d585505c (patch) | |
| tree | cee1e6388f63f99c7bb65b9b33be95051de0b9bd /src | |
| parent | 44a499f2acf10b55172d07abf387e5a579a585f7 (diff) | |
Fix division by zero
Fix uclouvain/openjpeg#733
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/openjp2/tcd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c index 7ecd97cf..b8cd3072 100644 --- a/src/lib/openjp2/tcd.c +++ b/src/lib/openjp2/tcd.c @@ -720,7 +720,8 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, /* 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)) { + /* issue 733, l_data_size == 0U, probably something wrong should be checked before getting here */ + if ((l_data_size > 0U) && ((((OPJ_UINT32)-1) / l_data_size) < (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0))) { opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n"); return OPJ_FALSE; } |
