Bug 688725 - 64-bit/32-bit behaves differently for these pdf files
Summary: 64-bit/32-bit behaves differently for these pdf files
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 8.54
Hardware: PC Linux
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-29 12:47 UTC by Hin-Tak Leung
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Error: /rangecheck in --cvrs-- with this pdf on 64-bit (313.44 KB, application/pdf)
2006-05-29 12:51 UTC, Hin-Tak Leung
Details
Many Warning's of 'rangecheck' error on 64-bit (865.17 KB, application/pdf)
2006-05-29 12:56 UTC, Hin-Tak Leung
Details
patch for /rangecheck in --cvrs-- (1.14 KB, patch)
2006-05-29 19:54 UTC, Alex Cherepanov
Details | Diff
patch for 'rangecheck' (1.81 KB, patch)
2006-05-29 23:05 UTC, Alex Cherepanov
Details | Diff
new patch for /rangecheck in cvrs (850 bytes, patch)
2006-06-01 13:40 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hin-Tak Leung 2006-05-29 12:47:35 UTC
While testing for the AMD64 linux segfault (bug 688721), I ran
all the pdf's I can find in my hard disc (about 1800 of them)
through both 32-bit build and 64-build, with
     ps2pdf old.pdf new.pdf
and found some difference in behavior. One of them must be wrong.

Files to follow, and details of each.
Comment 1 Hin-Tak Leung 2006-05-29 12:51:13 UTC
Created attachment 2232 [details]
Error: /rangecheck in --cvrs-- with this pdf on 64-bit

32-bit ghostscript works fine, 64-bit ghostscript fails with this error:
 /home/hin-tak/.wine/drive_c/Program
Files/R/R-2.3.0/library/qvalue/doc/manual.pdf
-Error: /rangecheck in --cvrs--
-Operand stack:
-   --dict:7/7(L)--   TT1   1	--dict:6/6(L)--   --dict:6/6(L)--  
KDLOKD+TimesNewRoman   --dict:11/12(ro)(G)--   --nostringval--	
--dict:7/7(L)--   --dict
:7/7(L)--   150998   --dict:7/7(L)--   --nostringval--	 FontMatrix  
--nostringval--   FontBBox   --nostringval--   FontName   -2147483631	16  
(\000\000\
000\000\000\000\000\000)
-Execution stack:
-   %interp_exit   .runexec2   --nostringval--	 --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--	--nostringval--  
--nostringval-- 
  false   1   %stopped_push   1   3   %oparray_pop   1	 3   %oparray_pop   1  
3   %oparray_pop   --nostringval--   --nostringval--   4   1   12   --nostrin
gval--	 %for_pos_int_continue	 --nostringval--   --nostringval--  
--nostringval--   --nostringval--   %array_continue   --nostringval--	false  
1   %sto
pped_push   --nostringval--   %loop_continue   --nostringval--	
--nostringval--   --nostringval--   --nostringval--   --nostringval--  
--nostringval--   %a
rray_continue	--nostringval--   --nostringval--   --nostringval--  
--nostringval--   --nostringval--   --nostringval--   --nostringval--
-Dictionary stack:
-   --dict:1121/1686(ro)(G)--	--dict:2/20(G)--   --dict:75/200(L)--  
--dict:75/200(L)--   --dict:105/127(ro)(G)--   --dict:253/347(ro)(G)--	
--dict:21/24
(L)--	--dict:4/6(L)--   --dict:27/32(L)--   --dict:33/50(ro)(G)--  
--dict:24/40(L)--
-Current allocation mode is local
-AFPL Ghostscript 8.54: Unrecoverable error, exit code 1
Comment 2 Hin-Tak Leung 2006-05-29 12:56:04 UTC
Created attachment 2233 [details]
Many Warning's of 'rangecheck' error on 64-bit

This pdf file generates many 
**** Warning: File encountered 'rangecheck' error while processing an image.
with 64-bit ghostscript, but 32-bit ghostscript doesn't output such warnings.
Comment 3 Hin-Tak Leung 2006-05-29 13:11:06 UTC
I have got more than a few ( at least 5 to 10?) of each kind of the two 
errors among the 1800 pdf's. The errors don't look substantially different 
so I'll just mention it here without submitting files which have
similiar problems.
Comment 4 Alex Cherepanov 2006-05-29 19:54:36 UTC
Created attachment 2234 [details]
patch for /rangecheck in --cvrs--

Fix string overflow in cvrs on 64-bit systems. Calculate numeric value of
unique
ID as 32-bit unsigned value that can be stored as 8-byte hexadecimal string but
convert to signed and extend the sign to have a correct signed value in XUID.
Comment 5 Alex Cherepanov 2006-05-29 23:05:20 UTC
Created attachment 2235 [details]
patch for 'rangecheck' 

The problem may be caused by the padding data overwriting MaskedImage member
in the subclass. See bug 613909 for details. The hack in 613909 doesn't fix all
cases.

The patch has not been tested.
Comment 6 Hin-Tak Leung 2006-05-30 10:02:22 UTC
Thanks - the two patches make 64-bit binary passes/fails on the same files as
32-bit binary.
Comment 7 Alex Cherepanov 2006-05-31 17:23:56 UTC
The patch from the comment #4 causes a few regressions.
A better patch will be posted soon.
Comment 8 Alex Cherepanov 2006-06-01 05:08:18 UTC
The patch #5 has been tested and causes no regressions.
Comment 9 Alex Cherepanov 2006-06-01 13:40:23 UTC
Created attachment 2245 [details]
new patch for /rangecheck in cvrs

This is a new patch for rangecheck in cvrs.

The old patch mistakenly assumes that 
  16#80000000 xor 16#80000000 sub 
is a no-op on the 32-bit platform. In fact, PostScript arithmetics converts the

result to float when it exceeds the integer range.

The patch has been tested and causes on differences.
Comment 10 Alex Cherepanov 2006-06-07 18:53:47 UTC
The patch for 'rangecheck' is committed as rev. 6843.
The patch for 'rangecheck in --cvrs--' is committed as rev. 6844.