[ https://issues.apache.org/jira/browse/PDFBOX-5972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr resolved PDFBOX-5972. ------------------------------------- Fix Version/s: 3.0.5 PDFBox 4.0.0 Assignee: Tilman Hausherr Resolution: Fixed Thanks for the contribution and the work finding and fixing this! > Infinite loop in fontbox o.a.f.cmap.CMapParser#readNumber > --------------------------------------------------------- > > Key: PDFBOX-5972 > URL: https://issues.apache.org/jira/browse/PDFBOX-5972 > Project: PDFBox > Issue Type: Bug > Components: FontBox > Affects Versions: 3.0.3 PDFBox, 3.0.4 PDFBox > Reporter: Michael Flester > Assignee: Tilman Hausherr > Priority: Major > Fix For: 3.0.5 PDFBox, 4.0.0 > > Attachments: sample-decoded.pdf > > > The sample document attached goes into an infinite loop in > o.a.f.CMapParser.readNumber. > The attached document was created from proprietary content by using > o.a.p.tools.PDFSplit and o.a.p.tools.WriteDecodedDoc, so that we could remove > the proprietary content more easily. > > The very short stream at line 225/226 happens to end with '6', and this makes > the current readNumber routine rewind the EOF, and leaves it unable to > progress. > > Here is a patch that seems to fix this issue by not rewinding EOF. All > existing unit tests still pass with this patch (diff -w), and the sample > document exhibits normal behavior. > {noformat} > --- a/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java > +++ b/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java > @@ -652,7 +652,10 @@ public class CMapParser > buffer.append((char) nextByte); > nextByte = randomAcccessRead.read(); > } > + if (nextByte != -1) > + { > randomAcccessRead.rewind(1); > + } > String value = buffer.toString(); > try > { {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org