1 diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c 2 index 5de89cf0e..400ca8098 100644 3 --- a/third_party/libopenjpeg20/j2k.c 4 +++ b/third_party/libopenjpeg20/j2k.c 5 @@ -5715,7 +5715,7 @@ static OPJ_BOOL opj_j2k_add_mct(opj_tcp_t * p_tcp, opj_image_t * p_image, OPJ_UI 6 7 if (l_deco_array) { 8 l_data_size = MCT_ELEMENT_SIZE[l_deco_array->m_element_type] * p_image->numcomps * p_image->numcomps; 9 - if (l_deco_array->m_data_size != l_data_size) { 10 + if (l_deco_array->m_data_size != l_data_size || ! l_deco_array->m_data) { 11 return OPJ_FALSE; 12 } 13 14 @@ -5734,7 +5734,7 @@ static OPJ_BOOL opj_j2k_add_mct(opj_tcp_t * p_tcp, opj_image_t * p_image, OPJ_UI 15 16 if (l_offset_array) { 17 l_data_size = MCT_ELEMENT_SIZE[l_offset_array->m_element_type] * p_image->numcomps; 18 - if (l_offset_array->m_data_size != l_data_size) { 19 + if (l_offset_array->m_data_size != l_data_size || ! l_offset_array->m_data) { 20 return OPJ_FALSE; 21 } 22 23