You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2015/11/18 22:11:10 UTC

[jira] [Commented] (PDFBOX-3116) COSNumber NumberFormatException for large number

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

Tilman Hausherr commented on PDFBOX-3116:
-----------------------------------------

I could fix this, i.e. by trying {{new COSFloat(number)}} as "Plan B" if a NumberFormatException is thrown. But after I did, a new error came up, because some number is "-infinity" so we're not really getting forward. The numbers you show are smaller than 1E-300, but float MIN_VALUE = 1.401298464324817E-45f.

> COSNumber NumberFormatException for large number
> ------------------------------------------------
>
>                 Key: PDFBOX-3116
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3116
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 2.0.0
>            Reporter: Andrei T
>            Priority: Minor
>         Attachments: source.pdf
>
>
> When trying to load a pdf containing the following:
> <</Type/Pattern/TilingType 2/Resources 52 0 R/XStep 32767/BBox[-89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184 -89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184 89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184 89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184]/Matrix[0.61 0 0 -0.601 0 0.319]/YStep 32767/Length 28563/Filter/FlateDecode/PatternType 1/PaintType 1>>stream
> I get a NumberFormatException in 
> 	at org.apache.pdfbox.cos.COSNumber.get(COSNumber.java:109)
> 	at org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:929)
> 	at org.apache.pdfbox.pdfparser.BaseParser.parseCOSArray(BaseParser.java:648)
> 	at org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:856)
> 	at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionaryValue(BaseParser.java:148)
> 	at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionaryNameValuePair(BaseParser.java:272)
> 	at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionary(BaseParser.java:205)
> 	at org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:844)
> 	at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:751)
> 	at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:720)
> 	at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:651)
> 	at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:612)
> 	at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:203)
> 	at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:230)
> 	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:972)
> 	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:876)
> Adobe Reader and Chrome consider it a valid pdf and it load it.
> 	
> I cannot share the PDF because of copyright issues, but I reproduced it with :"pdfbox\src\test\resources\input\rendering\source.pdf" from pdfbox-2.0.0-RC1-src.zip.
> Changing the value 0 from "/BBox [0 0 2480 3508]" to -89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184 
> throws the exception. 	
> Using "new COSFloat(number)" works in this case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org