QPDF: Exception: operation for Name object attempted on object of wrong type

Bug #1397413 reported by Rodolfo
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdf (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Hello. I am trying to print the file at:

https://www.dropbox.com/s/a3v7afl7lajolvb/error1.pdf?dl=0

And I get this error:

Exception: operation for Name object attempted on object of wrong type

running "qpdf error1.pdf --show-pages" I get the same error.

Thanks

Rodolfo (bopodelvalle)
summary: - Exception: operation for Name object attempted on object of wrong type
+ QPDF: Exception: operation for Name object attempted on object of wrong
+ type
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Jay, can you have a look into this? Looks like an upstream bug in QPDF.

Revision history for this message
Jay Berkenbilt (ejb) wrote :

The problem is that the root object of the pages tree does not have a /Type key in its dictionary. The PDF spec says that /Type is required and must be /Pages for the root.

qpdf could and should handle this particular type of damage or could at least give a better error message for it, but that's the problem in this case. Right now qpdf uses /Type to determine whether a node in the pages tree is a Pages dictionary or Page dictionary, but it could use the presence of /Kids instead, which would probably be a bit more robust since it would handle more types of broken files.

It would be a simple change.

Revision history for this message
Jay Berkenbilt (ejb) wrote :

Before I commit this for real, I need to create a test case, but this seems to be a correct fix.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "page.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Rodolfo (bopodelvalle) wrote :

Is it possible to make a 5.1.2-3 version with this fix?

Revision history for this message
Jay Berkenbilt (ejb) wrote :

Debian is in freeze, but I could upload to experimental and ubuntu could sync from there if that works.

Revision history for this message
Rodolfo (bopodelvalle) wrote :

That may work, thanks ;)

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Jay, do it this way, syncing from Experimental is no problem for us.

Changed in qpdf (Ubuntu):
status: New → Triaged
Revision history for this message
Jay Berkenbilt (ejb) wrote :

Sorry for the long delay. I have uploaded 5.1.2-3 to experimental.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Synced 5.1.2-3 to Vivid.

Jay, thanks for the fix.

Changed in qpdf (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
ccurelaru (cristian-curelaru) wrote :

I have the same error from a file (that I can't share ) and this one has /Pages element. I compared against the sample from this bug using a tool that can read the internals.

I tried --check but it does not give me the details. Is there a way for me to find out what element is the problem in my case without having to debug (I am not too good with cpp) ?

This is the message:
Error in linearizing (QPDF) the PDF, result: [stderr] operation for Name object attempted on object of wrong type

thanks
Cris

Revision history for this message
Jay Berkenbilt (ejb) wrote :

Does your problem happen with 5.1.2-3?

Revision history for this message
ccurelaru (cristian-curelaru) wrote :

In the meantime, I was able to debug and found the issue : basically there is key 'Type' somewhere in the treee but the key is not a 'name' as expected but a string.

I browsed a bit the spec (PDF) and it does seem to suggest Type should always be a "name". However, other tools seem to not care about that and linearize the file (acrobat pro, pdftron). No preflight errors either from acrobat.

Thoughts ?

Revision history for this message
Jay Berkenbilt (ejb) wrote :

Having qpdf able to treat strings as names would be a pretty small enhancement and would probably improve its ability to handle a whole category of broken files. I'll try to work this in for the next update. Thanks for providing this detailed summary of the problem. Very helpful.

Revision history for this message
Jay Berkenbilt (ejb) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.