PDFedit Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000338 [GUI] =Other (GUI)= minor always 10-09-09 05:44 10-22-09 16:53
Reporter Alister View Status public  
Assigned To hockm0bm
Priority normal Resolution fixed  
Status resolved  
Summary 0000338: Pdfedit crashes if you try to open a "Pdf package"
Description (gdb) run
Starting program: /usr/local/bin/pdfedit.exe
[New thread 35952.0x8c5c]
[New thread 35952.0x8918]
[New thread 35952.0x7a0c]
[New thread 35952.0x8794]
[New thread 35952.0x8a34]
[New thread 35952.0x8ddc]
[New thread 35952.0x8ce0]
assertion "revStart>prevEnd" failed: file "xrefwriter.cc", line 945

Program exited with code 0103000.
(gdb) backtrace
No stack
Additional Information There is a warning page in the document that other viewers display to tell you that you need a viewer compatible with "Pdf packages".

"Pdf packages" were a new feature in Adobe 8, which is what I used to produce this one. You can extract the files from within a "Pdf package" using Adobe Reader (this may depend on the permissions of each file - I'm not sure). I think you can include other file types in a pdf package as well - if so I can produce an example if anyone needs it for some reason.

I suspect you won't want to support creating or editing pdf packages (at least in the near future, but if someone tries to open one with pdfedit it should at least display the explanation page that other viewers display, instead of crashing.

The documents that I combined are freely available on the internet so there shouldn't be a real problem with this being public.

FWIW with Adobe reader you can save the individual files out of a "Pdf package"
Attached Files  hybrid_file-multiversion-fix.patch [^] (4,379 bytes) 10-09-09 16:21

- Relationships
has duplicate 0000339closed  Pdfedit crashes if you try to open a "Pdf package" 
related to 0000340closed  Pdfedit crashes if you try to open a "Pdf package" 

- Notes
(0000984)
Alister
10-09-09 06:01

Sorry, I'm getting the error I've referred to previously when I try to upload an example "Pdf package" (only 4MB - I think the bugtracker just doesn't like any form of file compression), but I can of course email it to someone. (BTW I've got Michal's address already...)

And sorry about the multiple posts - as soon as my browser started loading the error page I clicked the back button, which avoided the freeze, and for some reason the bug reports got created anyway, without the attachment (that hasn't happened in the past when I had the error, so I don't know why it is different this time).
 
(0000989)
hockm0bm
10-09-09 09:32

This looks suspicious, because this assert makes perfect sense.
Please send me the file by email (mstsxfx at gmail dot com)
 
(0000990)
hockm0bm
10-09-09 11:44

OK, I have received your document and I can confirm that I can see the same behavior.

I will try to look into it ASAP.
 
(0000991)
hockm0bm
10-09-09 14:50

OK, I know where is the problem. When we look at the xref structure of the document:

[offset:4 141 574]
xref
0 118
0000000108 65535 f
0000000106 00000 f
0001988126 00000 n
[...]
[offset:4 143 947]
trailer
<</Size 118/Root 78 0 R>>
xref
0 0
trailer
<</Size 118/Prev 4141574/XRefStm 931/Root 78 0 R/Info 36 0 R/ID[<9C60B188EB6311DA9231000A95C39FE2><AAE1A106A4DF284A8F49EED0EC8ADE3F>]>>
startxref
4143983
%%EOF

As you can see we have 2 xref section. One with no entries which provides "hybrid reference" trailer. Prev points to the old style xref table while XRefStm points to the xref stream (PDFReference16.pdf: Chapter 3, Compatibility with PDF 1.4).

So far so good. Why do we fail on assertion then? The reason is in the way how we calculate end of a revision. In a "normal" document each revision ends with startxref keyword and XRefWriter::getRevisionEnd relies on that. As you can see in this file, though, xref is followed by xref keyword instead. Therefore we get the offset of the last startxref in the document.

I am thinking how to handle this situation properly. There are basically two options:
    - Don't consider such a special xref as a new revision (this document would have only one revision).
    - Change the calculation of the revision end.

The first option sounds like the way to go, but I am not sure how would we handle multiversion documents then. The second one sounds more like hack than a solution.
 
(0000992)
hockm0bm
10-09-09 16:24

hybrid_file-multiversion-fix.patch is the first way proposed way. I am not sure whether it fully comply PDF specification, though. I have sent this patch to our devel mailing list. Let's see if others come up with something else.

The other thing about this document is that even with the patch we are not displaying the whole content. I can see only one page (same in kpdf, xpdf or other xpdf-based viewers). When I open it in AcrobadReader 8 I can see 19 pages.

This would mean that xpdf doesn't handle hybrid version document correctly. I will file another bug for this.
 
(0000993)
Alister
10-09-09 22:32

> When I open it in AcrobadReader 8 I can see 19 pages.

That's not right. The first pdf it contains has 19 pages, the second one has 20, and then there are 6 more with one page each. I haven't got Reader 8 (only Reader 9) - maybe you need to turn on a toolbar or something, or click the button with the house on it...
 
(0000994)
hockm0bm
10-10-09 15:53

> This would mean that xpdf doesn't handle hybrid version document correctly. I
> will file another bug for this.

Reported as bt 0000342

>> When I open it in AcrobadReader 8 I can see 19 pages.

> That's not right. The first pdf it contains has 19 pages, the second one has
> 20, and then there are 6 more with one page each. I haven't got Reader 8 (only
> Reader 9) - maybe you need to turn on a toolbar or something, or click the
> button with the house on it...

Are there multiple documents bundled into one file? How do you select which one do you want to see?
 
(0000995)
Alister
10-11-09 09:42

Yes, there are multiple pdf files inside the "pdf package". I think it can also contain other types of file, although I'm not sure.

> How do you select which one do you want to see?
In Adobe Reader 9 there is a pane than has an icon you can click on for each file. You can also save them or open them in a new window, and I think the search function might search through all the files in the package.
There is a toolbar with some buttons that allow you to switch between displaying this pane with thumbnails, with something else (can't remember what exactly - I'm at home and don't have the pdf package), or hiding the pane at all. I don't know if Reader 8 works the same way.

There are also a couple of arrow buttons < > that jump to the next or previous file.
 
(0000996)
hockm0bm
10-22-09 16:53

Patch is in the CVS. Let's move discussion about multi file document into 0000342
 

- Issue History
Date Modified Username Field Change
10-09-09 05:44 Alister New Issue
10-09-09 06:01 Alister Note Added: 0000984
10-09-09 09:24 hockm0bm Relationship added has duplicate 0000339
10-09-09 09:24 hockm0bm Relationship added related to 0000340
10-09-09 09:25 hockm0bm Status new => assigned
10-09-09 09:25 hockm0bm Assigned To  => hockm0bm
10-09-09 09:32 hockm0bm Note Added: 0000989
10-09-09 11:44 hockm0bm Note Added: 0000990
10-09-09 14:50 hockm0bm Note Added: 0000991
10-09-09 16:21 hockm0bm File Added: hybrid_file-multiversion-fix.patch
10-09-09 16:24 hockm0bm Note Added: 0000992
10-09-09 22:32 Alister Note Added: 0000993
10-10-09 15:53 hockm0bm Note Added: 0000994
10-11-09 09:42 Alister Note Added: 0000995
10-22-09 16:53 hockm0bm Status assigned => resolved
10-22-09 16:53 hockm0bm Resolution open => fixed
10-22-09 16:53 hockm0bm Note Added: 0000996