summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/pi.c
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2015-01-15 18:16:29 +0000
committerAntonin Descampe <antonin@gmail.com>2015-01-15 18:16:29 +0000
commit5d00b719f4b93b1445e6fb4c766b9a9883c57949 (patch)
tree7c3ec4781c2ec94853e915566b3d6ea23eebbbe8 /src/lib/openjp2/pi.c
parent42132ed6b56120e45356a7c8cfdea7b6e39cd058 (diff)
[trunk] fixed a buffer overflow in opj_tcd_init_decode_tile
Update issue 431
Diffstat (limited to 'src/lib/openjp2/pi.c')
-rw-r--r--src/lib/openjp2/pi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/openjp2/pi.c b/src/lib/openjp2/pi.c
index 65ff6263..66e5b05c 100644
--- a/src/lib/openjp2/pi.c
+++ b/src/lib/openjp2/pi.c
@@ -708,10 +708,10 @@ void opj_get_all_encoding_parameters( const opj_image_t *p_image,
q = tileno / p_cp->tw;
/* here calculation of tx0, tx1, ty0, ty1, maxprec, l_dx and l_dy */
- *p_tx0 = opj_int_max((OPJ_INT32)(p_cp->tx0 + p * p_cp->tdx), (OPJ_INT32)p_image->x0);
- *p_tx1 = opj_int_min((OPJ_INT32)(p_cp->tx0 + (p + 1) * p_cp->tdx), (OPJ_INT32)p_image->x1);
- *p_ty0 = opj_int_max((OPJ_INT32)(p_cp->ty0 + q * p_cp->tdy), (OPJ_INT32)p_image->y0);
- *p_ty1 = opj_int_min((OPJ_INT32)(p_cp->ty0 + (q + 1) * p_cp->tdy), (OPJ_INT32)p_image->y1);
+ *p_tx0 = (OPJ_INT32)opj_uint_max(p_cp->tx0 + p * p_cp->tdx, p_image->x0);
+ *p_tx1 = (OPJ_INT32)opj_uint_min(p_cp->tx0 + (p + 1) * p_cp->tdx, p_image->x1);
+ *p_ty0 = (OPJ_INT32)opj_uint_max(p_cp->ty0 + q * p_cp->tdy, p_image->y0);
+ *p_ty1 = (OPJ_INT32)opj_uint_min(p_cp->ty0 + (q + 1) * p_cp->tdy, p_image->y1);
/* max precision and resolution is 0 (can only grow)*/
*p_max_prec = 0;