#645 AAIOBE in CCITTFaxDecoderStream now wrapped in IOException

This commit is contained in:
Harald Kuhr
2021-12-11 17:48:57 +01:00
parent bc328419ac
commit 3911191b04
3 changed files with 29 additions and 5 deletions
@@ -30,14 +30,14 @@
package com.twelvemonkeys.imageio.plugins.tiff;
import com.twelvemonkeys.lang.Validate;
import java.io.EOFException;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import com.twelvemonkeys.lang.Validate;
/**
* CCITT Modified Huffman RLE, Group 3 (T4) and Group 4 (T6) fax compression.
*
@@ -198,6 +198,10 @@ final class CCITTFaxDecoderStream extends FilterInputStream {
try {
decodeRow();
}
catch (ArrayIndexOutOfBoundsException e) {
// Mask the AIOOBE as an IOException
throw new IOException("Malformed CCITT stream", e);
}
catch (EOFException e) {
// TODO: Rewrite to avoid throw/catch for normal flow...
if (decodedLength != 0) {