blob: b2e7cdc75aa4ba8b0d3541ccceb37f4a0b90c34d [file] [log] [blame]
diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c
index c5f9dd53e..d31eb29a7 100644
--- a/third_party/libopenjpeg20/j2k.c
+++ b/third_party/libopenjpeg20/j2k.c
@@ -6201,7 +6201,7 @@ static OPJ_BOOL opj_j2k_add_mct(opj_tcp_t * p_tcp, opj_image_t * p_image,
if (l_deco_array) {
l_data_size = MCT_ELEMENT_SIZE[l_deco_array->m_element_type] * p_image->numcomps
* p_image->numcomps;
- if (l_deco_array->m_data_size != l_data_size) {
+ if (l_deco_array->m_data_size != l_data_size || ! l_deco_array->m_data) {
return OPJ_FALSE;
}
@@ -6222,7 +6222,7 @@ static OPJ_BOOL opj_j2k_add_mct(opj_tcp_t * p_tcp, opj_image_t * p_image,
if (l_offset_array) {
l_data_size = MCT_ELEMENT_SIZE[l_offset_array->m_element_type] *
p_image->numcomps;
- if (l_offset_array->m_data_size != l_data_size) {
+ if (l_offset_array->m_data_size != l_data_size || ! l_offset_array->m_data) {
return OPJ_FALSE;
}