diff options
| author | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-08-10 08:47:20 +0000 |
|---|---|---|
| committer | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-08-10 08:47:20 +0000 |
| commit | 9e419fdaf76d8100207b80627ec25ccfc535cb40 (patch) | |
| tree | bdfe645ccdbdcc0d9c8a99d7a0c697bba162bee3 /libopenjpeg | |
| parent | e634cd0d623d64f8bb64f3efc06aafbda3aa4097 (diff) | |
fixed glibc error with broken2 and broken4 images
Diffstat (limited to 'libopenjpeg')
| -rw-r--r-- | libopenjpeg/j2k.c | 17 |
1 files changed, 14 insertions, 3 deletions
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 */ |
