#713 PSD: Broken uncompressed reading from stream w/unknown length

(cherry picked from commit da800be8c8)
This commit is contained in:
Harald Kuhr
2022-11-10 16:11:34 +01:00
parent 1e981242ad
commit 0538db7103
3 changed files with 48 additions and 22 deletions
@@ -103,7 +103,8 @@ final class PSDUtil {
final int[] byteCounts, long compressedLength) throws IOException {
switch (compression) {
case PSD.COMPRESSION_NONE:
return new SubImageInputStream(stream, stream.length());
long streamLength = stream.length();
return new SubImageInputStream(stream, streamLength < 0 ? Long.MAX_VALUE : streamLength);
case PSD.COMPRESSION_RLE:
return new DirectImageInputStream(new SequenceInputStream(new LazyPackBitsStreamEnumeration(byteCounts, stream)));