diff options
| author | Antonin Descampe <antonin@gmail.com> | 2015-01-15 18:16:29 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2015-01-15 18:16:29 +0000 |
| commit | 5d00b719f4b93b1445e6fb4c766b9a9883c57949 (patch) | |
| tree | 7c3ec4781c2ec94853e915566b3d6ea23eebbbe8 /src/lib/openjp2/tcd.c | |
| parent | 42132ed6b56120e45356a7c8cfdea7b6e39cd058 (diff) | |
[trunk] fixed a buffer overflow in opj_tcd_init_decode_tile
Update issue 431
Diffstat (limited to 'src/lib/openjp2/tcd.c')
| -rw-r--r-- | src/lib/openjp2/tcd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c index eade5a91..a041bc1e 100644 --- a/src/lib/openjp2/tcd.c +++ b/src/lib/openjp2/tcd.c @@ -701,10 +701,11 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, /*fprintf(stderr, "Tile coordinate = %d,%d\n", p, q);*/ /* 4 borders of the tile rescale on the image if necessary */ - l_tile->x0 = opj_int_max((OPJ_INT32)(l_cp->tx0 + p * l_cp->tdx), (OPJ_INT32)l_image->x0); - l_tile->y0 = opj_int_max((OPJ_INT32)(l_cp->ty0 + q * l_cp->tdy), (OPJ_INT32)l_image->y0); - l_tile->x1 = opj_int_min((OPJ_INT32)(l_cp->tx0 + (p + 1) * l_cp->tdx), (OPJ_INT32)l_image->x1); - l_tile->y1 = opj_int_min((OPJ_INT32)(l_cp->ty0 + (q + 1) * l_cp->tdy), (OPJ_INT32)l_image->y1); + l_tile->x0 = (OPJ_INT32)opj_uint_max(l_cp->tx0 + p * l_cp->tdx, l_image->x0); + l_tile->y0 = (OPJ_INT32)opj_uint_max(l_cp->ty0 + q * l_cp->tdy, l_image->y0); + l_tile->x1 = (OPJ_INT32)opj_uint_min(l_cp->tx0 + (p + 1) * l_cp->tdx, l_image->x1); + l_tile->y1 = (OPJ_INT32)opj_uint_min(l_cp->ty0 + (q + 1) * l_cp->tdy, l_image->y1); + /* testcase 1888.pdf.asan.35.988 */ if (l_tccp->numresolutions == 0) { fprintf(stderr, "tiles require at least one resolution\n"); |
