From 9ac3a1572e06267215a9260a09a02a75260ca299 Mon Sep 17 00:00:00 2001 From: mayeut Date: Wed, 22 Jul 2015 00:10:32 +0200 Subject: [PATCH] Prevent overflow when coding 16 bits images Update uclouvain/openjpeg#539 --- src/lib/openjp2/tcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c index e926d4f5..1caa615f 100644 --- a/src/lib/openjp2/tcd.c +++ b/src/lib/openjp2/tcd.c @@ -1089,7 +1089,7 @@ static OPJ_BOOL opj_tcd_code_block_enc_allocate_data (opj_tcd_cblk_enc_t * p_cod if (p_code_block->data) { opj_free(p_code_block->data - 1); /* again, why -1 */ } - p_code_block->data = (OPJ_BYTE*) opj_malloc(l_data_size); + p_code_block->data = (OPJ_BYTE*) opj_malloc(l_data_size+1); if(! p_code_block->data) { p_code_block->data_size = 0U; return OPJ_FALSE; -- 2.40.0