|
|
94b862 |
Backport of upstream commit:
|
|
|
94b862 |
|
|
|
94b862 |
From 33cc2cfa51a8d0fc3116d16cc1d8fc581b3f9e8d Mon Sep 17 00:00:00 2001
|
|
|
94b862 |
From: Michael Adams <mdadams@ece.uvic.ca>
|
|
|
94b862 |
Date: Wed, 19 Oct 2016 15:02:20 -0700
|
|
|
94b862 |
Subject: [PATCH] The RCT and ICT require at least three components.
|
|
|
94b862 |
Previously, this was enforced with an assertion. Now, the assertion has been
|
|
|
94b862 |
replaced with a proper error check.
|
|
|
94b862 |
|
|
|
94b862 |
diff -pruN jasper-1.900.1.orig/src/libjasper/jpc/jpc_dec.c jasper-1.900.1/src/libjasper/jpc/jpc_dec.c
|
|
|
94b862 |
--- jasper-1.900.1.orig/src/libjasper/jpc/jpc_dec.c 2017-03-31 15:52:43.000000000 +0200
|
|
|
94b862 |
+++ jasper-1.900.1/src/libjasper/jpc/jpc_dec.c 2017-03-31 21:58:17.000000000 +0200
|
|
|
94b862 |
@@ -1070,12 +1070,18 @@ static int jpc_dec_tiledecode(jpc_dec_t
|
|
|
94b862 |
/* Apply an inverse intercomponent transform if necessary. */
|
|
|
94b862 |
switch (tile->cp->mctid) {
|
|
|
94b862 |
case JPC_MCT_RCT:
|
|
|
94b862 |
- assert(dec->numcomps >= 3);
|
|
|
94b862 |
+ if (dec->numcomps < 3) {
|
|
|
94b862 |
+ jas_eprintf("RCT requires at least three components\n");
|
|
|
94b862 |
+ return -1;
|
|
|
94b862 |
+ }
|
|
|
94b862 |
jpc_irct(tile->tcomps[0].data, tile->tcomps[1].data,
|
|
|
94b862 |
tile->tcomps[2].data);
|
|
|
94b862 |
break;
|
|
|
94b862 |
case JPC_MCT_ICT:
|
|
|
94b862 |
- assert(dec->numcomps >= 3);
|
|
|
94b862 |
+ if (dec->numcomps < 3) {
|
|
|
94b862 |
+ jas_eprintf("ICT requires at least three components\n");
|
|
|
94b862 |
+ return -1;
|
|
|
94b862 |
+ }
|
|
|
94b862 |
jpc_iict(tile->tcomps[0].data, tile->tcomps[1].data,
|
|
|
94b862 |
tile->tcomps[2].data);
|
|
|
94b862 |
break;
|
|
|
94b862 |
@@ -1127,7 +1133,7 @@ static int jpc_dec_tiledecode(jpc_dec_t
|
|
|
94b862 |
JPC_CEILDIV(dec->ystart, cmpt->vstep), jas_matrix_numcols(
|
|
|
94b862 |
tcomp->data), jas_matrix_numrows(tcomp->data), tcomp->data)) {
|
|
|
94b862 |
jas_eprintf("write component failed\n");
|
|
|
94b862 |
- return -4;
|
|
|
94b862 |
+ return -1;
|
|
|
94b862 |
}
|
|
|
94b862 |
}
|
|
|
94b862 |
|