You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/04/26 09:55:53 UTC

[GitHub] [commons-imaging] kinow commented on a change in pull request #144: [IMAGING-298] Throw ImageReadException if the PNG parser is given an …

kinow commented on a change in pull request #144:
URL: https://github.com/apache/commons-imaging/pull/144#discussion_r620146970



##########
File path: src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java
##########
@@ -74,4 +78,22 @@ public void test() throws Exception {
         }
     }
 
+    /**
+     * If the PNG image data contains an invalid ICC Profile, previous versions would
+     * simply rethrow the IAE. This test verifies we are instead raising the documented
+     * {@literal ImageReadException}.
+     *
+     * <p>See Google OSS Fuzz issue 33691</p>
+     *
+     * @throws IOException if it fails to read the test image
+     */
+    @Test
+    public void testUncaughtExceptionOssFuzz33691() throws IOException {
+        final String input = "/images/png/oss-fuzz-33691/clusterfuzz-testcase-minimized-ImagingPngFuzzer-6177282101215232";
+        final String file = PngReadTest.class.getResource(input).getFile();
+        final PngImageParser parser = new PngImageParser();
+        assertThrows(ImageReadException.class, () -> {
+            parser.getBufferedImage(new ByteSourceFile(new File(file)), Collections.emptyMap());

Review comment:
       Sounds good to me @arturobernalg , if you add a [suggestion](https://til.hashrocket.com/posts/szgdi4at59-github-insert-a-suggestion-) here I'll merge it (otherwise will update the PR tomorrow :bed: :crescent_moon: )




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org