1diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c 2index c5f9dd53e..d31eb29a7 100644 3--- a/third_party/libopenjpeg20/j2k.c 4+++ b/third_party/libopenjpeg20/j2k.c 5@@ -6201,7 +6201,7 @@ static OPJ_BOOL opj_j2k_add_mct(opj_tcp_t * p_tcp, opj_image_t * p_image, 6 if (l_deco_array) { 7 l_data_size = MCT_ELEMENT_SIZE[l_deco_array->m_element_type] * p_image->numcomps 8 * 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@@ -6222,7 +6222,7 @@ static OPJ_BOOL opj_j2k_add_mct(opj_tcp_t * p_tcp, opj_image_t * p_image, 15 if (l_offset_array) { 16 l_data_size = MCT_ELEMENT_SIZE[l_offset_array->m_element_type] * 17 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