summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2024-11-25 22:02:54 +0100
committerEven Rouault <even.rouault@spatialys.com>2024-11-25 22:16:23 +0100
commite492644fbded4c820ca55b5e50e598d346e850e8 (patch)
tree21c6e73c4455dfc71c5361ef70fda9ae79f05648 /src/lib
parent4ec0aca4d733a852186bbce82e58043095a372d4 (diff)
opj_j2k_add_tlmarker(): validate that current tile-part number if smaller that total number of tile-parts
Fixes #1564
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/j2k.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index 7dc389fa..b5903a59 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -8456,7 +8456,8 @@ static OPJ_BOOL opj_j2k_add_tlmarker(OPJ_UINT32 tileno,
if (type == J2K_MS_SOT) {
OPJ_UINT32 l_current_tile_part = cstr_index->tile_index[tileno].current_tpsno;
- if (cstr_index->tile_index[tileno].tp_index) {
+ if (cstr_index->tile_index[tileno].tp_index &&
+ l_current_tile_part < cstr_index->tile_index[tileno].nb_tps) {
cstr_index->tile_index[tileno].tp_index[l_current_tile_part].start_pos = pos;
}