]> granicus.if.org Git - openjpeg/commitdiff
Prevent overflow when coding 16 bits images
authormayeut <mayeut@users.noreply.github.com>
Tue, 21 Jul 2015 22:10:32 +0000 (00:10 +0200)
committermayeut <mayeut@users.noreply.github.com>
Tue, 21 Jul 2015 22:10:32 +0000 (00:10 +0200)
Update uclouvain/openjpeg#539

src/lib/openjp2/tcd.c

index e926d4f5bcf2109ec24e0fe6da5b150852411d5d..1caa615fbe6990c40048480a3eb562263c9366f5 100644 (file)
@@ -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;