#! /bin/sh /usr/share/dpatch/dpatch-run
# Description: fix denial of service and possible code execution via
#  icclib overflow
# Origin: Thanks to Red Hat

@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' ghostscript-8.71.dfsg.1~/icclib/icc.c ghostscript-8.71.dfsg.1/icclib/icc.c
--- ghostscript-8.71.dfsg.1~/icclib/icc.c	2009-07-28 03:48:19.000000000 -0400
+++ ghostscript-8.71.dfsg.1/icclib/icc.c	2012-09-21 08:55:30.355321681 -0400
@@ -5006,6 +5006,11 @@
 	p->clutPoints = read_UInt8Number(bp+10);
 
 	/* Sanity check */
+        if (p->inputChan < 1) {
+		sprintf(icp->err,"icmLut_read: No input channels!");
+		return icp->errc = 1;
+	}
+
 	if (p->inputChan > MAX_CHAN) {
 		sprintf(icp->err,"icmLut_read: Can't handle > %d input channels\n",MAX_CHAN);
 		return icp->errc = 1;
