Bug 691868 - DCTEncode filter crashes Ghostscript if QuantTables parameter specified
Summary: DCTEncode filter crashes Ghostscript if QuantTables parameter specified
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Images (show other bugs)
Version: 8.71
Hardware: PC Windows XP
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-05 23:26 UTC by Paul Tribick
Modified: 2011-01-06 19:19 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
patch (597 bytes, patch)
2011-01-06 19:17 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Tribick 2011-01-05 23:26:13 UTC
When using the DCTEncode filter, Ghostscript crashes if the QuantTables parameter is specified. Adobe Distiller 6.0 is happy with the code.

If QuantTables parameter is removed (ie using default tables), Ghostscript is happy.

%--

Edited code example (incomplete):

/DataSource { ... } def % provides one row of image data,
                        % ie SamplesPerPixel * ImageWidth bytes

/QTable1 	<0302020302020303030304030304050805050404050A070706080C0A0C0C0B0A0B0B0D0E12100D0E110E0B0B1016101113141515150C0F171816141812141514> def
/QTable2	<03040405040509050509140D0B0D1414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414> def

/SamplesPerPixel 3 def  % Or 1 for B&W

(DCTEncode_temp.jpg) (w) file
<<	/Columns	ImageWidth
	/Rows		ImageHeight
	/Colors		SamplesPerPixel
	/QFactor	1.0
	/QuantTables	[ QTable1 SamplesPerPixel 1 sub { QTable2 } repeat ]
>> /DCTEncode filter
ImageHeight { dup DataSource writestring } repeat
closefile
% ...

%--
Comment 1 Alex Cherepanov 2011-01-06 00:58:07 UTC
Please attach a full sample.
Comment 2 Alex Cherepanov 2011-01-06 17:56:42 UTC
The sample code is good enough. The problem is reproduced.
Thank you for using and testing Ghostscript.
Comment 3 Alex Cherepanov 2011-01-06 19:17:06 UTC
Created attachment 7096 [details]
patch

Fix a cut-ant-paste error in setting QuantTables for JPXEncode filter.
Comment 4 Alex Cherepanov 2011-01-06 19:19:48 UTC
The patch has been committed as a rev. 12003.