From e9606c02c148e410305bf959a51baab24aa88cd7 Mon Sep 17 00:00:00 2001 From: mayeut Date: Tue, 6 Sep 2016 21:06:15 +0200 Subject: [PATCH] fix incrementing of "l_tcp->m_nb_mcc_records" in opj_j2k_read_mcc --- src/lib/openjp2/j2k.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 01d1a4fff..1cff598c3 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -5405,6 +5405,7 @@ static OPJ_BOOL opj_j2k_read_mcc ( opj_j2k_t *p_j2k, OPJ_UINT32 l_nb_collections; OPJ_UINT32 l_nb_comps; OPJ_UINT32 l_nb_bytes_by_comp; + OPJ_BOOL l_new_mcc = OPJ_FALSE; /* preconditions */ assert(p_header_data != 00); @@ -5466,6 +5467,7 @@ static OPJ_BOOL opj_j2k_read_mcc ( opj_j2k_t *p_j2k, memset(l_mcc_record,0,(l_tcp->m_nb_max_mcc_records-l_tcp->m_nb_mcc_records) * sizeof(opj_simple_mcc_decorrelation_data_t)); } l_mcc_record = l_tcp->m_mcc_records + l_tcp->m_nb_mcc_records; + l_new_mcc = OPJ_TRUE; } l_mcc_record->m_index = l_indix; @@ -5601,7 +5603,9 @@ static OPJ_BOOL opj_j2k_read_mcc ( opj_j2k_t *p_j2k, return OPJ_FALSE; } - ++l_tcp->m_nb_mcc_records; + if (l_new_mcc) { + ++l_tcp->m_nb_mcc_records; + } return OPJ_TRUE; }