1 diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c 2 index e77edd22b..cb5a28373 100644 3 --- a/third_party/libopenjpeg20/j2k.c 4 +++ b/third_party/libopenjpeg20/j2k.c 5 @@ -2117,10 +2117,16 @@ static OPJ_BOOL opj_j2k_read_siz(opj_j2k_t *p_j2k, 6 if( l_img_comp->dx < 1 || l_img_comp->dx > 255 || 7 l_img_comp->dy < 1 || l_img_comp->dy > 255 ) { 8 opj_event_msg(p_manager, EVT_ERROR, 9 - "Invalid values for comp = %d : dx=%u dy=%u\n (should be between 1 and 255 according the JPEG2000 norm)", 10 + "Invalid values for comp = %d : dx=%u dy=%u (should be between 1 and 255 according to the JPEG2000 norm)\n", 11 i, l_img_comp->dx, l_img_comp->dy); 12 return OPJ_FALSE; 13 } 14 + if( l_img_comp->prec > 38) { /* TODO openjpeg won't handle more than ? */ 15 + opj_event_msg(p_manager, EVT_ERROR, 16 + "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm)\n", 17 + i, l_img_comp->prec); 18 + return OPJ_FALSE; 19 + } 20 21 #ifdef USE_JPWL 22 if (l_cp->correct) { 23