projects
/
openjpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
18b1138
)
opj_t2_encode_packet(): avoid out of bound access of #1297, but likely not the proper fix
1298/head
author
Even Rouault
<even.rouault@spatialys.com>
Wed, 2 Dec 2020 12:13:26 +0000
(13:13 +0100)
committer
Even Rouault
<even.rouault@spatialys.com>
Wed, 2 Dec 2020 12:13:26 +0000
(13:13 +0100)
src/lib/openjp2/t2.c
patch
|
blob
|
history
diff --git
a/src/lib/openjp2/t2.c
b/src/lib/openjp2/t2.c
index e452edd19b2fa09eb2d3b57b417f373ac1e13e9f..55f07c0cab973e225e3c0e983f43f092f8878176 100644
(file)
--- a/
src/lib/openjp2/t2.c
+++ b/
src/lib/openjp2/t2.c
@@
-815,6
+815,15
@@
static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
continue;
}
+ /* Avoid out of bounds access of https://github.com/uclouvain/openjpeg/issues/1297 */
+ /* but likely not a proper fix. */
+ if (precno >= res->pw * res->ph) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "opj_t2_encode_packet(): accessing precno=%u >= %u\n",
+ precno, res->pw * res->ph);
+ return OPJ_FALSE;
+ }
+
prc = &band->precincts[precno];
l_nb_blocks = prc->cw * prc->ch;
cblk = prc->cblks.enc;