Skip to content

Commit 8308060

Browse files
committed
Fixes #402, #403.
JPEG-2000 (JPC) Decoder: - Added the setting of several pointers to null in some cleanup code after the pointed-to memory was freed. This pointer nulling is not needed normally, but it is needed when certain debugging logs are enabled (so that the debug code understands that the memory associated with the aforementioned pointers has been freed).
1 parent de788fb commit 8308060

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

data/test/bad/poc_402.jpc

296 Bytes
Binary file not shown.

data/test/bad/poc_403.jpc

296 Bytes
Binary file not shown.

src/libjasper/jpc/jpc_dec.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,23 +1136,23 @@ static int jpc_dec_tilefini(jpc_dec_t *dec, jpc_dec_tile_t *tile)
11361136

11371137
if (tile->cp) {
11381138
jpc_dec_cp_destroy(tile->cp);
1139-
//tile->cp = 0;
1139+
tile->cp = 0;
11401140
}
11411141
if (tile->tcomps) {
11421142
jas_free(tile->tcomps);
1143-
//tile->tcomps = 0;
1143+
tile->tcomps = 0;
11441144
}
11451145
if (tile->pi) {
11461146
jpc_pi_destroy(tile->pi);
1147-
//tile->pi = 0;
1147+
tile->pi = 0;
11481148
}
11491149
if (tile->pkthdrstream) {
11501150
jas_stream_close(tile->pkthdrstream);
1151-
//tile->pkthdrstream = 0;
1151+
tile->pkthdrstream = 0;
11521152
}
11531153
if (tile->pptstab) {
11541154
jpc_ppxstab_destroy(tile->pptstab);
1155-
//tile->pptstab = 0;
1155+
tile->pptstab = 0;
11561156
}
11571157

11581158
tile->state = JPC_TILE_DONE;
@@ -2288,6 +2288,9 @@ static int jpc_dec_dump(const jpc_dec_t *dec)
22882288
const jpc_dec_tile_t *tile;
22892289
for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles;
22902290
++tileno, ++tile) {
2291+
if (!tile->tcomps) {
2292+
continue;
2293+
}
22912294
assert(!dec->numcomps || tile->tcomps);
22922295
unsigned compno;
22932296
const jpc_dec_tcomp_t *tcomp;

0 commit comments

Comments
 (0)