[ https://issues.apache.org/jira/browse/PDFBOX-4626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16903605#comment-16903605
]
ASF subversion and git services commented on PDFBOX-4626:
---------------------------------------------------------
Commit 1864768 from Tilman Hausherr in branch 'pdfbox/branches/issue4569'
[ https://svn.apache.org/r1864768 ]
PDFBOX-4626: avoid ArrayIndexOutOfBoundsException
> ArrayIndexOutOfBounds exceptions in CmapSubtable parsing
> --------------------------------------------------------
>
> Key: PDFBOX-4626
> URL: https://issues.apache.org/jira/browse/PDFBOX-4626
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 2.0.16, 3.0.0 PDFBox
> Environment: openjdk version "1.8.0_212"
> OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
> OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)
> MacOS Mojave
>
> Reporter: Alex Rebert
> Assignee: Tilman Hausherr
> Priority: Minor
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: fontbox-exceptions-2.zip
>
>
> {{TTFParser.parse}} can lead to ArrayIndexOutOfBounds exceptions when parsing malformed inputs.
> *Steps to repro*
> # Create & compile Main.java:
> {code:java}
> import org.apache.fontbox.ttf.TTFParser;
> class Main {
> public static void main(String[] args) throws Throwable {
> (new TTFParser()).parse(System.in);
> }
> }{code}
> * Download the attached inputs and extract them.
> * For each input, run {{cat <input> | java -cp 'jars/*' Main}} to reproduce
the exceptions, where `jars` is a folder containing the pdfbox jars.
> *Stacktraces*
> {noformat}
> $ cat ArrayIndexOutOfBoundsException.CmapSubtable.processSubtype13.320 | java -cp 'jars/*'
Main
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
> at org.apache.fontbox.ttf.CmapSubtable.processSubtype13(CmapSubtable.java:320)
> at org.apache.fontbox.ttf.CmapSubtable.initSubtable(CmapSubtable.java:114)
> at org.apache.fontbox.ttf.CmapTable.read(CmapTable.java:86)
> at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
> at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:173)
> at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:150)
> at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:106)
> at Main.main(Main.java:5){noformat}
> {noformat}
> $ cat ArrayIndexOutOfBoundsException.CmapSubtable.processSubtype8.192 | java -cp 'jars/*'
Main
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
> at org.apache.fontbox.ttf.CmapSubtable.processSubtype8(CmapSubtable.java:192)
> at org.apache.fontbox.ttf.CmapSubtable.initSubtable(CmapSubtable.java:105)
> at org.apache.fontbox.ttf.CmapTable.read(CmapTable.java:86)
> at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
> at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:173)
> at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:150)
> at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:106)
> at Main.main(Main.java:5){noformat}
> {noformat}
> $ cat ArrayIndexOutOfBoundsException.CmapSubtable.processSubtype8.167 | java -cp 'jars/*'
Main
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8192
> at org.apache.fontbox.ttf.CmapSubtable.processSubtype8(CmapSubtable.java:167)
> at org.apache.fontbox.ttf.CmapSubtable.initSubtable(CmapSubtable.java:105)
> at org.apache.fontbox.ttf.CmapTable.read(CmapTable.java:86)
> at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
> at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:173)
> at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:150)
> at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:106)
> at Main.main(Main.java:5){noformat}
> The files were generated by fuzzing and are (probably) not valid TTF files. This is a
follow-up to PDFBOX-4622. I fuzzed fontbox again after applying the patch from that issue
(revision https://svn.apache.org/repos/asf/pdfbox/trunk@1864677).
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
|