[
https://issues.apache.org/jira/browse/PDFBOX-5672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tilman Hausherr updated PDFBOX-5672:
------------------------------------
Affects Version/s: 3.0.0 PDFBox
2.0.29
4.0.0
> PDFToImage might not correctly detect unsupported image formats
> ---------------------------------------------------------------
>
> Key: PDFBOX-5672
> URL: https://issues.apache.org/jira/browse/PDFBOX-5672
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.29, 3.0.0 PDFBox, 4.0.0
> Reporter: Axel Howind
> Priority: Minor
> Attachments: fix_detection_of_unsupported_image_file_formats.patch
>
>
> PDFToImage contains this code:
> {code:java}
> if (getImageFormats().indexOf(imageFormat) == -1)
> {
> SYSERR.println( "Error: Invalid image format " + imageFormat + "
> - supported are: " + getImageFormats());
> return 2;
> }
> {code}
> Here, `getImageFormats()` is called to create a concatenated comma-separated
> string that contains all supported image formats. The problem is that a
> simple string search is carried out on the concatenated string. Imagine
> (hypothetical case) that "jpeg2000" is supported, but "jpeg" is not. If you
> pass in "jpeg", it will not be detected that the file format is unsupported.
> The solution is to check to formats returned by ImageIO directly. At the same
> time, the `getImageFormats()`method can be replaced by a simple one-liner.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]