diff options
| author | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2014-02-27 17:21:00 +0000 |
|---|---|---|
| committer | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2014-02-27 17:21:00 +0000 |
| commit | a3472624683709544fa98c33ed8a3137b4436959 (patch) | |
| tree | 38a7c88a93cc1be768fe6e5fef895f99a4fc41af /src/lib | |
| parent | 6a6fa7027a1d1aac466bfb09fd3b431dc30f1c1f (diff) | |
[trunk] Import patch from issue 218. No dataset to check, so blindly applied it.
Fixes issue 218
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/jp2.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index 544ce91b..d59ec434 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -823,6 +823,7 @@ static OPJ_BOOL opj_jp2_check_color(opj_image_t *image, opj_jp2_color_t *color, return OPJ_TRUE; } +// file9.jp2 void opj_jp2_apply_pclr(opj_image_t *image, opj_jp2_color_t *color) { opj_image_comp_t *old_comps, *new_comps; @@ -1076,7 +1077,8 @@ void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color) for(i = 0; i < n; ++i) { /* WATCH: acn = asoc - 1 ! */ - if((asoc = info[i].asoc) == 0) + asoc = info[i].asoc; + if(asoc == 0 || asoc == 65535) { if (i < image->numcomps) image->comps[i].alpha = info[i].typ; @@ -1085,6 +1087,11 @@ void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color) cn = info[i].cn; acn = asoc - 1; + if( cn >= image->numcomps || acn >= image->numcomps ) + { + fprintf(stderr, "cn=%d, acn=%d, numcomps=%d\n", cn, acn, image->numcomps); + continue; + } if(cn != acn) { |
