diff --git a/CHANGES b/CHANGES index 74b36e88..8ee45225 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ What's New for OpenJPEG August 10, 2011 ! [mickael] removed unused parameters warnings with the solution proposed by myself and Bob Friesenhahn. ! [mickael] add copyright header into new test functions. +* [mickael] fixed glibc error with broken2 and broken4 images. August 9, 2011 - [antonin] removed xcode project files (cmake and autotools are now the only supported build methods) diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 0a58a81a..32e8bd95 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -838,6 +838,15 @@ static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) { }; }; + +#else + /* We check whether there are too many subbands */ + if ((numbands < 0) || (numbands >= J2K_MAXBANDS)) { + opj_event_msg(j2k->cinfo, EVT_WARNING , + "bad number of subbands in Sqcx (%d) regarding to J2K_MAXBANDS (%d) \n" + "- limiting number of bands to J2K_MAXBANDS and try to move to the next markers\n", numbands, J2K_MAXBANDS); + } + #endif /* USE_JPWL */ for (bandno = 0; bandno < numbands; bandno++) { @@ -850,8 +859,10 @@ static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) { expn = tmp >> 11; mant = tmp & 0x7ff; } - tccp->stepsizes[bandno].expn = expn; - tccp->stepsizes[bandno].mant = mant; + if (bandno < J2K_MAXBANDS){ + tccp->stepsizes[bandno].expn = expn; + tccp->stepsizes[bandno].mant = mant; + } } /* Add Antonin : if scalar_derived -> compute other stepsizes */ @@ -915,7 +926,7 @@ static void j2k_read_qcc(opj_j2k_t *j2k) { int len, compno; int numcomp = j2k->image->numcomps; opj_cio_t *cio = j2k->cio; - + len = cio_read(cio, 2); /* Lqcc */ compno = cio_read(cio, numcomp <= 256 ? 1 : 2); /* Cqcc */