You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/01/13 23:31:39 UTC

[jira] [Commented] (IMAGING-178) PnmImageParser does not check the validity of input PAM header

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

Gary Gregory commented on IMAGING-178:
--------------------------------------

Thank you for your report. Are you willing to provide a patch?

> PnmImageParser does not check the validity of input PAM header
> --------------------------------------------------------------
>
>                 Key: IMAGING-178
>                 URL: https://issues.apache.org/jira/browse/IMAGING-178
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: PNM
>            Reporter: emopers
>
> PnmImageParser.java directly calls tokenizer.nextToken() at line no 160, 163, 166, 169 and 172 on java.util.StringTokenizer tokenizer without checking if there are more tokens.  Because tokenizer is built from the bytes string that can be invalid, this can lead to a runtime exception without a useful error message.  This can be easily fixed by calling tokenizer.hasMoreTokens() before calling tokenizer.nextToken() at each line number mentioned before and throwing useful error message.



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