[ 
https://issues.apache.org/jira/browse/PDFBOX-6342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18152032#comment-18152032
 ] 

ASF subversion and git services commented on PDFBOX-6342:
---------------------------------------------------------

Commit 1940817 from Tilman Hausherr in branch 'pdfbox/branches/3.0'
[ https://svn.apache.org/r1940817 ]

PDFBOX-6342: avoid ClassCastException, as suggested by Adomas Birštunas

> PdfBox use invalid type for UseCMap field
> -----------------------------------------
>
>                 Key: PDFBOX-6342
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6342
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Preflight
>    Affects Versions: 2.0.36, 3.0.8 PDFBox
>            Reporter: Adomas Birštunas
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.38, 3.0.9 PDFBox
>
>         Attachments: veraPDF test suite 6-2-11-3-3-t03-pass-a.pdf
>
>
> {color:#000000}PDF-1.7 section 9.7.5.3: optional field UseCMap type is name 
> or stream.{color}
>  
> {_}{color:#000000}org.apache.pdfbox.preflight.font{color}.{_}{color:#000000}_Type0FontValidator_
>  method {color}
> _{color:#00627a}processCMapAsStream{color}({color:#000000}COSStream 
> {color}aCMap)_ use cast {color:#000000}UseCMap {color}field into 
> {color:#000000}{_}COSDictionary{_}.{color}
> {color:#000000}Despite this on the next line _cmapUsed_ is provided to method 
> {color}
> {_}checkCMapEncoding(..){_}, which expects to get {_}COSName{_}, 
> {_}COSStream{_}, or {_}COSString{_}.
>  
> Therefore, parameter _{color:#000000}cmapUsed{color}type_ shall be _COSBase_ 
> and no cast to be performed.
>  
> An example of the PDF file provided.
> (edit by Tilman: )
> Running preflight with the attached file brings this:
> {noformat}
> Exception in thread "main" java.lang.ClassCastException: 
> org.apache.pdfbox.cos.COSName cannot be cast to 
> org.apache.pdfbox.cos.COSDictionary
>         at 
> org.apache.pdfbox.preflight.font.Type0FontValidator.processCMapAsStream(Type0FontValidator.java:285)
>         at 
> org.apache.pdfbox.preflight.font.Type0FontValidator.checkCMapEncoding(Type0FontValidator.java:226)
>         at 
> org.apache.pdfbox.preflight.font.Type0FontValidator.checkEncoding(Type0FontValidator.java:203)
>         at 
> org.apache.pdfbox.preflight.font.Type0FontValidator.validate(Type0FontValidator.java:73)
> {noformat}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [jira] [Commented] (PDFBOX-... ASF subversion and git services (Jira) via dev

Reply via email to