File jasper-CVE-2025-8837.patch of Package jasper.40244
8308060d3fbc1da10353ac8a95c8ea60eba9c25a
Index: jasper-1.900.14/src/libjasper/jpc/jpc_dec.c
===================================================================
--- jasper-1.900.14.orig/src/libjasper/jpc/jpc_dec.c
+++ jasper-1.900.14/src/libjasper/jpc/jpc_dec.c
@@ -1014,23 +1014,23 @@ static int jpc_dec_tilefini(jpc_dec_t *d
if (tile->cp) {
jpc_dec_cp_destroy(tile->cp);
- //tile->cp = 0;
+ tile->cp = 0;
}
if (tile->tcomps) {
jas_free(tile->tcomps);
- //tile->tcomps = 0;
+ tile->tcomps = 0;
}
if (tile->pi) {
jpc_pi_destroy(tile->pi);
- //tile->pi = 0;
+ tile->pi = 0;
}
if (tile->pkthdrstream) {
jas_stream_close(tile->pkthdrstream);
- //tile->pkthdrstream = 0;
+ tile->pkthdrstream = 0;
}
if (tile->pptstab) {
jpc_ppxstab_destroy(tile->pptstab);
- //tile->pptstab = 0;
+ tile->pptstab = 0;
}
tile->state = JPC_TILE_DONE;
@@ -2067,6 +2067,9 @@ static int jpc_dec_dump(jpc_dec_t *dec,
assert(!dec->numtiles || dec->tiles);
for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles;
++tileno, ++tile) {
+ if (!tile->tcomps) {
+ continue;
+ }
assert(!dec->numcomps || tile->tcomps);
for (compno = 0, tcomp = tile->tcomps; compno < dec->numcomps;
++compno, ++tcomp) {