[gs-cvs] gs/src

Dan Coby dan at ghostscript.com
Wed Jul 13 14:21:49 PDT 2005


Update of /cvs/ghostscript/gs/src
In directory casper2:/tmp/cvs-serv14049/src

Modified Files:
	zcsindex.c 
Log Message:
Fix for 688206 rangecheck in --setcolorspace--.  Actually there is a
problem with the PDF test files.  The 'fix' is to make Ghostscript more
tolerant of errors.

DETAILS:

The problem is an error in the file.  The file contains an Indexed color space:
 [ /Indexed /DeviceGray 255 (\000%Mr\r2[\300\320\303\000\b\f\021\026\034"\)UMB9
\201%Ns\r2[\016\035,:\036-<KYh=L[ix\207\\kz\210\227\246{\212\231\247\266\305
\267\306\325\005\024"1 at O$3AP_mCQ`o~\214bp\177\216\234\253\200\217\236\255\273
\312\256\275\314\332\351\n\031\(6ET\)8GUdsHWft\203gv\204\223\242\261\206\225
\262\301\317\245\263\321\340_Ul[<K\020=-iYM\\Lz\210x{\212\231\247\266\213\232
\243\267\306\325\252\271\251\326\345\364\025\0363AP/CQ`o~Sbk\177\216\227r\200
\217\236\255\273\221\237\256\275\314\332\257\276\310\334\352\371$8G4...) ]

The lookup table for this color space should contain 256 bytes.  Instead it 
contains 768 bytes (3 times the needed number of bytes).

The PDF 1.6 specification on page 233 (section 4.55) says:

  The color table data must be m x (hival + 1) bytes long, where m is the
  number of color components in the base color space.

Thus having 768 bytes is an actual error for this case.

Apparently Acrobat 6.0 ignores this error since it does not complain about the 
file.

Since Acrobat accepts these files, I have modified the length test to
accept any look up table which has the needed number of data bytes.

The files were produced by Amyuni PDF Converter (Version 2.08b Pro).


Index: zcsindex.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/zcsindex.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- zcsindex.c	4 Aug 2004 19:36:13 -0000	1.7
+++ zcsindex.c	13 Jul 2005 21:21:47 -0000	1.8
@@ -79,7 +79,13 @@
 	int num_values = num_entries * cs_num_components(&cs);
 
 	check_read(pcsa[2]);
-	if (r_size(&pcsa[2]) != num_values)
+	/*
+	 * The PDF and PS specifications state that the lookup table must have
+	 * the exact number of of data bytes needed.  However we have found
+	 * PDF files from Amyuni with extra data bytes.  Acrobat 6.0 accepts
+	 * these files without complaint, so we ignore the extra data.
+	 */
+	if (r_size(&pcsa[2]) < num_values)
 	    return_error(e_rangecheck);
 	memmove(&cs.params.indexed.base_space, &cs,
 		sizeof(cs.params.indexed.base_space));



More information about the gs-cvs mailing list