mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
#955: PSD: Fix overflow issue found in GIMP PSD
This commit is contained in:
parent
83cff35076
commit
fa49dd93a7
@ -142,7 +142,8 @@ final class PSDUtil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream nextElement() {
|
public InputStream nextElement() {
|
||||||
return new SubStream(new DecoderStream(createStreamAdapter(stream, byteCounts[index++]), new PackBitsDecoder(), rowLength), rowLength);
|
// Add 128 bytes extra buffer as worst case if the encoder (GIMP) added garbage bytes at the end
|
||||||
|
return new SubStream(new DecoderStream(createStreamAdapter(stream, byteCounts[index++]), new PackBitsDecoder(), rowLength + 128), rowLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,9 @@ public class PSDImageReaderTest extends ImageReaderAbstractTest<PSDImageReader>
|
|||||||
// CMYK, uncompressed + contains some uncommon MeSa (instead of 8BIM) resource blocks
|
// CMYK, uncompressed + contains some uncommon MeSa (instead of 8BIM) resource blocks
|
||||||
new TestData(getClassLoaderResource("/psd/fruit-cmyk-MeSa-resource.psd"), new Dimension(400, 191)),
|
new TestData(getClassLoaderResource("/psd/fruit-cmyk-MeSa-resource.psd"), new Dimension(400, 191)),
|
||||||
// 3 channel, RGB, 32 bit samples
|
// 3 channel, RGB, 32 bit samples
|
||||||
new TestData(getClassLoaderResource("/psd/32bit5x5.psd"), new Dimension(5, 5))
|
new TestData(getClassLoaderResource("/psd/32bit5x5.psd"), new Dimension(5, 5)),
|
||||||
|
// 3 channel, RGB, written by GIMP, compressed with PackBits runs longer than the row length
|
||||||
|
new TestData(getClassLoaderResource("/psd/gimp-32x32-packbits-overflow.psd"), new Dimension(32, 32))
|
||||||
// TODO: Need more recent ZIP compressed PSD files from CS2/CS3+
|
// TODO: Need more recent ZIP compressed PSD files from CS2/CS3+
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user