Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Nov 2011 12:22:52 GMT
From:      Sebastian Klemke <sebastian.klemke@first.fraunhofer.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/162812: [patch] graphics/jasper fails on some JPEG2000 pictures
Message-ID:  <201111241222.pAOCMqJF005841@red.freebsd.org>
Resent-Message-ID: <201111241230.pAOCUC2Z032790@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         162812
>Category:       ports
>Synopsis:       [patch] graphics/jasper fails on some JPEG2000 pictures
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 24 12:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Sebastian Klemke
>Release:        7.3-RELEASE-p6
>Organization:
Fraunhofer FIRST
>Environment:
FreeBSD cage30 7.3-RELEASE-p6 FreeBSD 7.3-RELEASE-p6 #9: Tue Sep  6 12:27:58 CEST 2011     root@themis0.first.fraunhofer.de:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
jasper fails with an assertion on some JPEG2000 pictures, the output is:

---
$ jasper --input icon.jp2 --output icon.bmp
Assertion failed: (dec->numcomps == 3), function jpc_dec_tiledecode, file jpc_de
c.c, line 1072.
Abort
---

There's a Debian Bug report containing an attachment which triggers the bug on:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469786

The picture itself can be downloaded from:

http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=icon.jp2;att=2;bug=469786

This bug in libjasper also causes ghostscript's gsc to dump core on some PDFs generated by Adobe InDesign, I can send a test file if needed. I have successfully tested the patch used for the current Debian package of jasper and have attached a patch to graphics/jasper to fix the problem.
>How-To-Repeat:
1. make -C /usr/ports/graphics/jasper
2. fetch -o icon.jp2 http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=icon.jp2;att=2;bug=469786 
3. jasper --input icon.jp2 --output icon.bmp
>Fix:
Apply the attached patch to the jasper port and update graphics/jasper on your system.

Patch attached with submission follows:

diff -urN /usr/ports/graphics/jasper/Makefile /var/ports/local/graphics/jasper/Makefile
--- /usr/ports/graphics/jasper/Makefile	2011-09-24 00:23:16.000000000 +0200
+++ /var/ports/local/graphics/jasper/Makefile	2011-11-24 12:59:13.000000000 +0100
@@ -7,7 +7,7 @@
 
 PORTNAME=	jasper
 PORTVERSION=	1.900.1
-PORTREVISION=	9
+PORTREVISION=	10
 CATEGORIES=	graphics
 MASTER_SITES=	http://www.ece.uvic.ca/~mdadams/jasper/software/ \
 		${MASTER_SITE_IMAGEMAGICK}
diff -urN /usr/ports/graphics/jasper/files/patch-jpc_dec.c /var/ports/local/graphics/jasper/files/patch-jpc_dec.c
--- /usr/ports/graphics/jasper/files/patch-jpc_dec.c	1970-01-01 01:00:00.000000000 +0100
+++ /var/ports/local/graphics/jasper/files/patch-jpc_dec.c	2011-11-24 12:55:04.000000000 +0100
@@ -0,0 +1,17 @@
+--- src/libjasper/jpc/jpc_dec.c	2007-01-19 22:43:07.000000000 +0100
++++ src/libjasper/jpc/jpc_dec.c	2011-11-09 15:04:49.000000000 +0100
+@@ -1069,12 +1069,12 @@
+ 	/* Apply an inverse intercomponent transform if necessary. */
+ 	switch (tile->cp->mctid) {
+ 	case JPC_MCT_RCT:
+-		assert(dec->numcomps == 3);
++		assert(dec->numcomps == 3 || dec->numcomps == 4);
+ 		jpc_irct(tile->tcomps[0].data, tile->tcomps[1].data,
+ 		  tile->tcomps[2].data);
+ 		break;
+ 	case JPC_MCT_ICT:
+-		assert(dec->numcomps == 3);
++		assert(dec->numcomps == 3 || dec->numcomps == 4);
+ 		jpc_iict(tile->tcomps[0].data, tile->tcomps[1].data,
+ 		  tile->tcomps[2].data);
+ 		break;


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111241222.pAOCMqJF005841>