summaryrefslogtreecommitdiff
path: root/libopenjpeg/t2.c
diff options
context:
space:
mode:
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2006-12-04 14:59:33 +0000
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2006-12-04 14:59:33 +0000
commit2c03b73dff9710b58231321de96bc0d6146e7c79 (patch)
tree0f98d90299f6e72703a55bc028d591c1f8cf7794 /libopenjpeg/t2.c
parent6cc148e2267a9075f7c83726638f21c4b1ca36b2 (diff)
First integration of JPWL code
Diffstat (limited to 'libopenjpeg/t2.c')
-rw-r--r--libopenjpeg/t2.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libopenjpeg/t2.c b/libopenjpeg/t2.c
index dea2bb9e..d82d0c74 100644
--- a/libopenjpeg/t2.c
+++ b/libopenjpeg/t2.c
@@ -519,6 +519,25 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
if (c + seg->newlen > src + len) {
return -999;
}
+
+/* UniPG>> */
+#ifdef USE_JPWL
+ /* we need here a j2k handle to verify if making a check to
+ the validity of cblocks parameters is selected from user (-W) */
+
+ /* let's check that we are not exceeding */
+ if ((cblk->len + seg->newlen) > 8192) {
+ fprintf(stderr, "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
+ seg->newlen, cblkno, precno, bandno, resno, compno);
+ if (!JPWL_ASSUME)
+ exit(-1);
+ seg->newlen = 8192 - cblk->len;
+ fprintf(stderr, " - truncating segment to %d\n", seg->newlen);
+ break;
+ };
+
+#endif /* USE_JPWL */
+/* <<UniPG */
memcpy(cblk->data + cblk->len, c, seg->newlen);
if (seg->numpasses == 0) {