Skip to content

Instantly share code, notes, and snippets.

@nijikon
Last active December 27, 2015 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nijikon/5154039c919cbc8d6610 to your computer and use it in GitHub Desktop.
Save nijikon/5154039c919cbc8d6610 to your computer and use it in GitHub Desktop.
an assertion fails when Jasper is fed certain JPEG-2000 files with an alpha channel. See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469786
--- a/src/libjasper/jpc/jpc_dec.c.orig 2015-12-27 21:58:46.000000000 +0100
+++ a/src/libjasper/jpc/jpc_dec.c 2015-12-27 22:01:41.000000000 +0100
@@ -1069,12 +1069,18 @@
/* Apply an inverse intercomponent transform if necessary. */
switch (tile->cp->mctid) {
case JPC_MCT_RCT:
- assert(dec->numcomps == 3);
+ if (dec->numcomps != 3 && dec->numcomps != 4) {
+ jas_eprintf("bad number of components (%d)\n", dec->numcomps);
+ return -1;
+ }
jpc_irct(tile->tcomps[0].data, tile->tcomps[1].data,
tile->tcomps[2].data);
break;
case JPC_MCT_ICT:
- assert(dec->numcomps == 3);
+ if (dec->numcomps != 3 && dec->numcomps != 4) {
+ jas_eprintf("bad number of components (%d)\n", dec->numcomps);
+ return -1;
+ }
jpc_iict(tile->tcomps[0].data, tile->tcomps[1].data,
tile->tcomps[2].data);
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment