Skip to content

Commit

Permalink
Merge pull request #690 from rouault/failed_malloc_opj_dwt_encode_pro…
Browse files Browse the repository at this point in the history
…cedure

[git/2.1 regression] Fix opj_write_tile() failure when numresolutions=1
  • Loading branch information
malaterre committed Jan 9, 2016
2 parents 0dd44e7 + 6a1974d commit cb33ff4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/openjp2/dwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ static INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void

l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * (OPJ_UINT32)sizeof(OPJ_INT32);
bj = (OPJ_INT32*)opj_malloc((size_t)l_data_size);
if (! bj) {
/* l_data_size is equal to 0 when numresolutions == 1 but bj is not used */
/* in that case, so do not error out */
if (l_data_size != 0 && ! bj) {
return OPJ_FALSE;
}
i = l;
Expand Down

0 comments on commit cb33ff4

Please sign in to comment.