summaryrefslogtreecommitdiff
path: root/gs/lib
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2014-08-01 09:52:00 +0100
committerKen Sharp <ken.sharp@artifex.com>2014-08-01 09:52:00 +0100
commit80395ccbe7558e324ff3cb75c3e241ce0ffd735d (patch)
treefe3848933565b7aeed237d4e1c3ccfc7e5d0b151 /gs/lib
parent9fbecef99a40d8a5b372fadf4ed99fe29c6815a9 (diff)
downloadghostpdl-80395ccbe7558e324ff3cb75c3e241ce0ffd735d.tar.gz
ps2write - fix a bug in the debug code
The PrintHex routine assumes that PostScript integers are 32 bits wide. This is no longer guaranteed with GS. This fix ensures that after we do the bit shifting to isolate 4 bits for conversion to hex, we don't have a number > 15, which could occur if the integer was sufficiently large. This prevents the code throwing an error when debugging. No differences expected
Diffstat (limited to 'gs/lib')
-rw-r--r--gs/lib/opdfread.ps7
1 files changed, 6 insertions, 1 deletions
diff --git a/gs/lib/opdfread.ps b/gs/lib/opdfread.ps
index 72167a799..fbcf62c5e 100644
--- a/gs/lib/opdfread.ps
+++ b/gs/lib/opdfread.ps
@@ -156,9 +156,14 @@ end % A dictionary for local binding
/HexDigits (0123456789ABCDEF) readonly def
+%% This routine assumes that a PostScript int is only 32 bits
+%% we partially address that by and'ing 15 with the 4 bits of
+%% data in order to ensure that we don't index off the end of
+%% the string above. However, if the integer is genuinely
+%% more than 32 bits we still only print the first 32.
/PrintHex % <int> PrintHex -
{ 8 {
- dup -28 bitshift //HexDigits exch 1 getinterval //=only exec
+ dup -28 bitshift 15 and //HexDigits exch 1 getinterval //=only exec
4 bitshift
} repeat
pop