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 2023/09/16 10:14:00 UTC
[jira] [Resolved] (PDFBOX-5672) PDFToImage might not correctly detect unsupported image formats
[ https://issues.apache.org/jira/browse/PDFBOX-5672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr resolved PDFBOX-5672.
-------------------------------------
Fix Version/s: 2.0.30
3.0.1 PDFBox
4.0.0
Assignee: Tilman Hausherr
Resolution: Fixed
Thanks!
> 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
> Components: Utilities
> Affects Versions: 2.0.29, 3.0.0 PDFBox, 4.0.0
> Reporter: Axel Howind
> Assignee: Tilman Hausherr
> Priority: Minor
> Fix For: 2.0.30, 3.0.1 PDFBox, 4.0.0
>
> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org