> Invoking `ImageReaderSpi.canDecodeInput(Object)` with a stream having less > than 8 bytes causes an `EOFException` to be thrown instead of returning > `false`. This is caused by BMP, WBMP, GIF, PNG and TIFF reader > implementations assuming that those bytes always exist and not checking EOF > conditions. The JPEG reader is not impacted. > > The `CanDecodeTest` class in this pull request reproduces the problem and > verifies that the patch solves it. The changes in `canDecodeInput(Object)` > method bodies are: > > * Use `ImageInputStream.read()` instead of `readByte()` and check for -1 > (EOF) return value. > * Replace `ImageInputStream.readFully(byte[])` calls by a private > `tryReadFully` method.
Martin Desruisseaux has updated the pull request incrementally with one additional commit since the last revision: Test all plugins, not only "BMP". ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8700/files - new: https://git.openjdk.java.net/jdk/pull/8700/files/a8737570..38f0cf34 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8700&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8700&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8700.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8700/head:pull/8700 PR: https://git.openjdk.java.net/jdk/pull/8700