diff options
| author | Mickael Savinaud <savmickael@users.noreply.github.com> | 2012-11-26 16:24:29 +0000 |
|---|---|---|
| committer | Mickael Savinaud <savmickael@users.noreply.github.com> | 2012-11-26 16:24:29 +0000 |
| commit | 59582bafa39fc2e0e20e10c0538dbc59d3948deb (patch) | |
| tree | d9d672a71834f212b39f07ef4887cc7afeacee24 /src/lib | |
| parent | 1ad85ac9eeb7c0b037e5209c6d3f10e80802790b (diff) | |
[trun[trunk] check if the dx and dy steps are not incorrect according to the JPEG2000 norm (thanks Even).
Test associated to this issue should nicely fail. Fixes issue 194
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/j2k.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 0c0fb102..3b439fc7 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -1998,6 +1998,13 @@ static OPJ_BOOL opj_j2k_read_siz(opj_j2k_t *p_j2k, opj_read_bytes(p_header_data,&tmp,1); /* YRsiz_i */ ++p_header_data; l_img_comp->dy = (OPJ_INT32)tmp; /* should be between 1 and 255 */ + if( l_img_comp->dx < 1 || l_img_comp->dx > 255 || + l_img_comp->dy < 1 || l_img_comp->dy > 255 ) { + opj_event_msg(p_manager, EVT_ERROR, + "Invalid values for comp = %d : dx=%u dy=%u\n (should be between 1 and 255 according the JPEG2000 norm)", + i, l_img_comp->dx, l_img_comp->dy); + return OPJ_FALSE; + } #ifdef USE_JPWL if (l_cp->correct) { |
