Bug 693000 - Error reading a content stream.
Summary: Error reading a content stream.
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: PC All
: P2 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-23 22:29 UTC by Marcos H. Woehrmann
Modified: 2012-07-18 22:47 UTC (History)
0 users

See Also:
Customer: 412
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2012-04-23 22:29:41 UTC
Ghostscript reports this warning converting the attached file:

   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.

and renders the file with much of the content missing.  Other PDF interpreters, including Adobe Acrobat, Apple Preview, and mu render the file correctly (mu does report a warning "warning: expected 'endobj' or 'stream' keyword (36 0 R)").

The command line I'm using for testing:

  bin/gs -sDEVICE=ppmraw -o test.ppm ./test-image-5.pdf
Comment 1 Marcos H. Woehrmann 2012-04-23 22:31:28 UTC
The customer reports:

The problem is likely the embedded fonts.  In particular the Type1 font wrapped in a composite (object 11) is the likely suspect.
Comment 3 Marcos H. Woehrmann 2012-04-23 22:33:19 UTC
Here is the tail of the -dPDFDEBUG output:


%Resolving: [10 0]
<<
/Name /V10F /Type /Font /Subtype /Type0 /BaseFont /RaconteurNF /Encoding 17 0 R
/DescendantFonts [
22 0 R
]
/ToUnicode 17 0 R
>>
endobj
%Resolving: [17 0]
<<
/Type /CMap /CMapName /G1GlyphIdentity /CIDSystemInfo <<
/Registry (Adobe) /Ordering (Identity) /Supplement 0 >>
/WMode 0 /Length 689 >>
stream
%FilePosition: 26962
endobj
%Resolving: [22 0]
<<
/Type /Font /Subtype /CIDFontType2 /BaseFont /RaconteurNF /CIDSystemInfo <<
/Registry (Adobe) /Ordering (Identity) /Supplement 0 >>
/FontDescriptor 21 0 R
/CIDToGIDMap 18 0 R
/W 19 0 R
>>
endobj
%Resolving: [21 0]
<<
/Type /FontDescriptor /FontName /RaconteurNF /Flags 4 /FontBBox [
-133 -266 1078 821 ]
/ItalicAngle 0 /Ascent 700 /Descent -200 /CapHeight 500 /StemV 0 /FontFile2 20 0 R
>>
endobj
%Resolving: [20 0]
<<
/Length 69292 /Length1 69292 >>
stream
%FilePosition: 46430
endobj
%Resolving: [19 0]
[
32 [
265 229 409 561 391 851 657 229 326 ]
41 [
326 438 632 224 259 224 398 694 315 561 644 670 650 667 466 597 ]
57 [
667 224 ]
59 [
224 596 632 596 425 790 704 581 657 693 642 ]
70 [
642 790 655 226 407 512 565 703 702 866 618 866 616 440 657 790 ]
86 [
918 1251 696 791 567 374 398 374 ]
95 [
500 315 704 581 657 693 642 ]
102 [
642 790 655 226 407 564 565 703 702 866 618 866 618 496 657 790 ]
118 [
918 1251 696 791 567 387 ]
125 [
387 ]
160 [
265 229 383 518 718 791 ]
167 [
1206 349 800 479 405 632 ]
174 [
609 309 333 632 301 337 315 790 652 224 287 192 534 405 778 925 ]
190 [
882 425 704 ]
193 197 704 198 [
1071 657 642 ]
201 203 642 204 207 226 208 [
753 702 866 ]
211 214 866 215 [
537 854 790 ]
218 220 790 221 [
791 611 823 704 ]
225 229 704 230 [
1071 657 642 ]
233 235 642 236 239 226 240 [
753 702 866 ]
243 246 866 247 [
632 854 790 ]
250 252 790 253 [
791 611 791 ]
338 339 1185 352 [
440 496 ]
376 [
791 ]
381 382 567 402 [
875 ]
710 711 393 730 [
142 ]
732 [
330 ]
956 [
790 ]
8211 [
632 1032 ]
8216 8218 229 8220 8222 409 8224 [
711 660 420 ]
8230 [
672 ]
8240 [
1027 ]
8249 8250 245 8364 [
718 ]
8482 [
623 ]
8722 [
632 ]
]
endobj
%Resolving: [18 0]
<<
/Length 17446 >>
stream
%FilePosition: 27707
endobj
0 0 1 rg
1 0 0 1 19.8 790.8 Tm
(\000T\000R\000Y\000M\000E\000 \000T\000e\000l\000e\000c\000o\000m) Tj
/V11F 18.0 Tf
%Resolving: [11 0]
<<
/Name /V11F /Type /Font /Subtype /Type0 /BaseFont /z003034l /DescendantFonts [
28 0 R
]
/Encoding 24 0 R
/ToUnicode 23 0 R
>>
endobj
%Resolving: [24 0]
<<
/Type /CMap /CMapName /PBS-AG-1 /CIDSystemInfo <<
/Registry (PBS) /Ordering (AG) /Supplement 1 >>
/WMode 0 /Length 3399 >>
stream
%FilePosition: 117363
endobj
%Resolving: [28 0]
<<
/Type /Font /Subtype /CIDFontType0 /BaseFont /z003034l /CIDSystemInfo <<
/Registry (PBS) /Ordering (AG) /Supplement 1 >>
/FontDescriptor 27 0 R
/W 25 0 R
>>
endobj
%Resolving: [27 0]
<<
/Type /FontDescriptor /FontName /z003034l /Flags 4 /FontBBox [
-133 -266 1078 821 ]
/ItalicAngle 0 /Ascent 700 /Descent -200 /CapHeight 500 /StemV 10 /FontFile 26 0 R
>>
endobj
%Resolving: [26 0]
<<
/Length 47621 /Length1 961 /Length2 46126 /Length3 534 >>
stream
%FilePosition: 121969
endobj
%Resolving: [25 0]
[
1 [
620 600 520 700 620 580 620 680 380 400 660 580 840 700 600 540 ]
17 18 600 19 [
460 500 740 640 880 560 ]
25 [
560 620 740 820 660 620 ]
31 35 620 36 [
520 700 620 ]
39 41 620 42 45 380 46 [
580 700 600 ]
49 52 600 53 [
460 740 ]
55 57 740 58 [
560 620 540 560 420 ]
63 [
420 340 440 340 320 400 440 240 220 440 240 620 460 400 440 400 ]
79 [
300 320 ]
81 [
320 460 440 680 420 400 440 540 560 440 420 240 520 ]
94 [
520 420 ]
96 100 420 101 105 340 106 109 240 110 [
300 460 400 ]
113 116 400 117 [
320 460 ]
119 121 460 122 [
400 440 400 440 400 440 ]
128 142 440 143 145 264 146 [
220 260 220 ]
149 [
220 ]
151 [
220 240 ]
153 [
240 360 340 280 ]
157 158 280 159 [
380 400 380 340 260 240 340 280 ]
167 [
280 500 ]
170 [
260 220 240 320 780 420 460 480 420 160 220 700 440 400 520 ]
185 188 520 190 [
500 440 180 240 ]
194 195 240 196 197 260 198 [
520 660 ]
200 201 660 202 [
60 680 960 480 360 220 300 ]
209 [
300 220 340 ]
212 [
340 440 ]
214 [
440 400 300 280 440 740 ]
220 [
740 220 600 520 ]
224 228 520 229 [
500 520 460 220 ]
]
endobj
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.

   **** This file had errors that were repaired or ignored.
%Resolving: [2 0]
<<
/Title (Document) /Producer (Rendering Engine 9.8M7p6543) >>
endobj
   **** The file was produced by: 
   **** >>>> Rendering Engine 9.8M7p6543 <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
Comment 4 Alex Cherepanov 2012-04-24 14:28:03 UTC
Probably, the problem is unrelated to the file structure.
pdfinflt.ps cannot decompress this file.
Comment 5 Alex Cherepanov 2012-04-24 15:58:17 UTC
Ghostscript can render the file after this change in the file.
Our PDF interpreter should verify the subtype attribute.
The decompression problem is an unrelated bug.


*** test-image-5.pdf    2012-04-23 23:55:55.773184403 -0400
--- h.pdf       2012-04-24 11:52:50.183535159 -0400
***************
*** 2776,2782 ****
  28 0 obj
  <<
  /Type /Font
! /Subtype /CIDFontType0
  /BaseFont /z003034l
  /CIDSystemInfo <<
   /Registry (PBS)
--- 2776,2782 ----
  28 0 obj
  <<
  /Type /Font
! /Subtype /Type1       
  /BaseFont /z003034l
  /CIDSystemInfo <<
   /Registry (PBS)
Comment 6 Alex Cherepanov 2012-04-24 19:13:29 UTC
A patch that verifies /Subtype attribute of a CIDFont resource
has been committed as:

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=430e9e345c84912f953161aa843b37f235c97708