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 2021/01/16 06:29:00 UTC
[jira] [Resolved] (PDFBOX-5080) Type1Parser.parseASCII throws
inconsistent exceptions
[ https://issues.apache.org/jira/browse/PDFBOX-5080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr resolved PDFBOX-5080.
-------------------------------------
Fix Version/s: 3.0.0 PDFBox
2.0.23
Assignee: Tilman Hausherr
Resolution: Fixed
> Type1Parser.parseASCII throws inconsistent exceptions
> -----------------------------------------------------
>
> Key: PDFBOX-5080
> URL: https://issues.apache.org/jira/browse/PDFBOX-5080
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.22
> Reporter: Hao Zhong
> Assignee: Tilman Hausherr
> Priority: Major
> Fix For: 2.0.23, 3.0.0 PDFBox
>
>
> The code of this method is as follows:
> {code:java}
> private void parseASCII(byte[] bytes) throws IOException
> {
> if (bytes.length == 0)
> {
> throw new IllegalArgumentException("byte[] is empty");
> } // %!FontType1-1.0
> // %!PS-AdobeFont-1.0
> if (bytes.length < 2 || (bytes[0] != '%' && bytes[1] != '!'))
> {
> throw new IOException("Invalid start of ASCII segment");
> }
> ...
> }
> {code}
> When length is zero, it throws IllegalArgumentException, but when length is below two and its contents are not as expected, it throws IOException. It looks strange. For me, in both cases, it shall throw IOException.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org