diff options
| author | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2016-01-09 14:53:29 +0100 |
|---|---|---|
| committer | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2016-01-09 14:53:29 +0100 |
| commit | cb33ff43bb289c8beb94a3cdeac1e53432f30abe (patch) | |
| tree | 4782e53fba0913203bd63963fdd86b7469f14435 | |
| parent | 0dd44e7dba540e69114a24c81e9190786ed32fed (diff) | |
| parent | 6a1974d40d95d857377a1eb5f4db0d9e24d0ad0a (diff) | |
Merge pull request #690 from rouault/failed_malloc_opj_dwt_encode_procedure
[git/2.1 regression] Fix opj_write_tile() failure when numresolutions=1
| -rw-r--r-- | src/lib/openjp2/dwt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c index d63c120e..a4ff01ba 100644 --- a/src/lib/openjp2/dwt.c +++ b/src/lib/openjp2/dwt.c @@ -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; |
