projects
/
openjpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a1eec9c
)
opj_j2k_setup_encoder(): validate number of tiles to avoid illegal values and potenti...
1401/head
author
Even Rouault
<even.rouault@spatialys.com>
Tue, 18 Jan 2022 14:44:18 +0000
(15:44 +0100)
committer
Even Rouault
<even.rouault@spatialys.com>
Tue, 18 Jan 2022 14:44:18 +0000
(15:44 +0100)
src/lib/openjp2/j2k.c
patch
|
blob
|
history
diff --git
a/src/lib/openjp2/j2k.c
b/src/lib/openjp2/j2k.c
index 91683f55d79f1b137334bc9dae8d4f09cf611914..e1901a319091cf18217ca50d2dc5715f0c74c579 100644
(file)
--- a/
src/lib/openjp2/j2k.c
+++ b/
src/lib/openjp2/j2k.c
@@
-7953,6
+7953,13
@@
OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
(OPJ_INT32)cp->tdx);
cp->th = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->y1 - cp->ty0),
(OPJ_INT32)cp->tdy);
+ /* Check that the number of tiles is valid */
+ if (cp->tw > 65535 / cp->th) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Invalid number of tiles : %u x %u (maximum fixed by jpeg2000 norm is 65535 tiles)\n",
+ cp->tw, cp->th);
+ return OPJ_FALSE;
+ }
} else {
cp->tdx = image->x1 - cp->tx0;
cp->tdy = image->y1 - cp->ty0;