summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Darbois <mayeut@users.noreply.github.com>2016-04-28 19:20:14 +0200
committerMatthieu Darbois <mayeut@users.noreply.github.com>2016-04-28 19:20:14 +0200
commite166e4a209d9a3e4b583e4b2cdcbab2c57967eb1 (patch)
treeb702329b458aeb8f10b1ae4237b2c230ee05a3ea
parent29313eb5f1b2c01c7493087fa2d8f1a20495a34e (diff)
Check SSIZ is valid in opj_j2k_read_siz (#762)
-rw-r--r--src/lib/openjp2/j2k.c8
-rw-r--r--tests/nonregression/CMakeLists.txt3
2 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index 525f629a..f6be14de 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -2154,10 +2154,16 @@ static OPJ_BOOL opj_j2k_read_siz(opj_j2k_t *p_j2k,
if( l_img_comp->dx < 1 || l_img_comp->dx > 255 ||
l_img_comp->dy < 1 || l_img_comp->dy > 255 ) {
opj_event_msg(p_manager, EVT_ERROR,
- "Invalid values for comp = %d : dx=%u dy=%u\n (should be between 1 and 255 according the JPEG2000 norm)",
+ "Invalid values for comp = %d : dx=%u dy=%u (should be between 1 and 255 according to the JPEG2000 norm)\n",
i, l_img_comp->dx, l_img_comp->dy);
return OPJ_FALSE;
}
+ if( l_img_comp->prec > 38) { /* TODO openjpeg won't handle more than ? */
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm)\n",
+ i, l_img_comp->prec);
+ return OPJ_FALSE;
+ }
#ifdef USE_JPWL
if (l_cp->correct) {
diff --git a/tests/nonregression/CMakeLists.txt b/tests/nonregression/CMakeLists.txt
index ce95af87..40283169 100644
--- a/tests/nonregression/CMakeLists.txt
+++ b/tests/nonregression/CMakeLists.txt
@@ -37,7 +37,7 @@ set(BLACKLIST_JPEG2000_TMP
#edf_c2_20.jp2 #looks ok as per kdu_jp2info
edf_c2_1377017.jp2
edf_c2_1002767.jp2
- #edf_c2_10025.jp2
+ edf_c2_10025.jp2
edf_c2_1000234.jp2
edf_c2_225881.jp2
edf_c2_1000671.jp2
@@ -46,6 +46,7 @@ set(BLACKLIST_JPEG2000_TMP
edf_c2_101463.jp2
edf_c2_1674177.jp2
edf_c2_1673169.jp2
+ issue418.jp2
issue429.jp2
issue427-null-image-size.jp2
issue427-illegal-tile-offset.jp2