diff options
| author | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-08-10 09:00:34 +0000 |
|---|---|---|
| committer | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-08-10 09:00:34 +0000 |
| commit | 6fb9794200d0d096ef2ee8734fd10c920cc0febe (patch) | |
| tree | af29bf807b02d0ad1321e2110eadb42c9bf958b6 /libopenjpeg/tcd.c | |
| parent | 9e419fdaf76d8100207b80627ec25ccfc535cb40 (diff) | |
fixed segfault with 123.j2c and bug.j2c images (thanks to Tim Mattox for his contribution to this patch)
Diffstat (limited to 'libopenjpeg/tcd.c')
| -rw-r--r-- | libopenjpeg/tcd.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c index fc25179a..9c7bcc0d 100644 --- a/libopenjpeg/tcd.c +++ b/libopenjpeg/tcd.c @@ -1418,18 +1418,23 @@ opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno if (tcd->tcp->mct) { int n = (tile->comps[0].x1 - tile->comps[0].x0) * (tile->comps[0].y1 - tile->comps[0].y0); - if (tcd->tcp->tccps[0].qmfbid == 1) { - mct_decode( - tile->comps[0].data, - tile->comps[1].data, - tile->comps[2].data, - n); - } else { - mct_decode_real( - (float*)tile->comps[0].data, - (float*)tile->comps[1].data, - (float*)tile->comps[2].data, - n); + + if (tile->numcomps >= 3 ){ + if (tcd->tcp->tccps[0].qmfbid == 1) { + mct_decode( + tile->comps[0].data, + tile->comps[1].data, + tile->comps[2].data, + n); + } else { + mct_decode_real( + (float*)tile->comps[0].data, + (float*)tile->comps[1].data, + (float*)tile->comps[2].data, + n); + } + } else{ + opj_event_msg(tcd->cinfo, EVT_WARNING,"Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",tile->numcomps); } } |
