You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Sean Bridges (JIRA)" <ji...@apache.org> on 2009/05/13 20:29:45 UTC
[jira] Created: (PDFBOX-471) invalid dictionary crashes parser
invalid dictionary crashes parser
---------------------------------
Key: PDFBOX-471
URL: https://issues.apache.org/jira/browse/PDFBOX-471
Project: PDFBox
Issue Type: Bug
Affects Versions: 0.8.0-incubator
Reporter: Sean Bridges
Fix For: 0.8.0-incubator
this is with svn version 774426
I am trying to parse an invalid xml document, with a dictionary of the form
/Producer (Virtual Print Engine PDF v1.0)
/CreationDate (D:20081120145900)
/Author (PowerGUI)
/Title (Document Title)
/Subject
/Creator (Some Creator)
Clearly, the /Subject dictionary value is invalid, but it would be nice if PDFBox didn't throw.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PDFBOX-471) invalid dictionary crashes parser
Posted by "Sean Bridges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean Bridges updated PDFBOX-471:
--------------------------------
Attachment: patch
This patch fixes the issue. It ignores dictionary content that cannot be parsed, and makes getString in COSDictioanry more lenient
> invalid dictionary crashes parser
> ---------------------------------
>
> Key: PDFBOX-471
> URL: https://issues.apache.org/jira/browse/PDFBOX-471
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 0.8.0-incubator
> Reporter: Sean Bridges
> Fix For: 0.8.0-incubator
>
> Attachments: patch
>
>
> this is with svn version 774426
> I am trying to parse an invalid xml document, with a dictionary of the form
> /Producer (Virtual Print Engine PDF v1.0)
> /CreationDate (D:20081120145900)
> /Author (PowerGUI)
> /Title (Document Title)
> /Subject
> /Creator (Some Creator)
> Clearly, the /Subject dictionary value is invalid, but it would be nice if PDFBox didn't throw.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PDFBOX-471) invalid dictionary crashes parser
Posted by "Sean Bridges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709195#action_12709195 ]
Sean Bridges commented on PDFBOX-471:
-------------------------------------
Another related change is to allow null values in a dictionary without throwing.
--- src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
+++ src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
@@ -214,9 +214,11 @@
if( value == null )
{
- throw new IOException("Bad Dictionary Declaration " + pdfSource );
+ logger().warning("Bad Dictionary Declaration " + pdfSource );
+ } else
+ {
+ obj.setItem( key, value );
}
- obj.setItem( key, value );
}
}
char ch = (char)pdfSource.read();
> invalid dictionary crashes parser
> ---------------------------------
>
> Key: PDFBOX-471
> URL: https://issues.apache.org/jira/browse/PDFBOX-471
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 0.8.0-incubator
> Reporter: Sean Bridges
> Fix For: 0.8.0-incubator
>
> Attachments: patch
>
>
> this is with svn version 774426
> I am trying to parse an invalid xml document, with a dictionary of the form
> /Producer (Virtual Print Engine PDF v1.0)
> /CreationDate (D:20081120145900)
> /Author (PowerGUI)
> /Title (Document Title)
> /Subject
> /Creator (Some Creator)
> Clearly, the /Subject dictionary value is invalid, but it would be nice if PDFBox didn't throw.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (PDFBOX-471) invalid dictionary crashes parser
Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler resolved PDFBOX-471.
---------------------------------------
Resolution: Fixed
I've added Seans patch with version 810122. I did't include the part for COSDictionary.getString because there was already a similar change in the code.
Thanks to Sean for the contribution.
> invalid dictionary crashes parser
> ---------------------------------
>
> Key: PDFBOX-471
> URL: https://issues.apache.org/jira/browse/PDFBOX-471
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 0.8.0-incubator
> Reporter: Sean Bridges
> Fix For: 0.8.0-incubator
>
> Attachments: patch
>
>
> this is with svn version 774426
> I am trying to parse an invalid xml document, with a dictionary of the form
> /Producer (Virtual Print Engine PDF v1.0)
> /CreationDate (D:20081120145900)
> /Author (PowerGUI)
> /Title (Document Title)
> /Subject
> /Creator (Some Creator)
> Clearly, the /Subject dictionary value is invalid, but it would be nice if PDFBox didn't throw.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.