mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[webp] producing I/O exception instead of hard assertion on opening malformed images
GitOrigin-RevId: a354881c15d75a66bba661e6dab040a9815b0dfe
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e6eb00eedc
commit
5308f61b0e
@@ -206,9 +206,7 @@ public final class WebpImageReaderSpi extends ImageReaderSpi {
|
||||
@Override
|
||||
public @NotNull BufferedImage read(int imageIndex, ImageReadParam param) throws IOException {
|
||||
loadInfoIfNeeded();
|
||||
if (myError == 0) {
|
||||
throw new IOException(UNABLE_TO_READ_WEBP_IMAGE);
|
||||
}
|
||||
if (myError == 0) throw new IOException(UNABLE_TO_READ_WEBP_IMAGE);
|
||||
assert myInputBytes != null;
|
||||
byte[] argb = libwebp.WebPDecodeARGB(myInputBytes, myInputBytes.length, myWidthOut, myHeightOut);
|
||||
@SuppressWarnings("UndesirableClassUsage")
|
||||
@@ -216,7 +214,7 @@ public final class WebpImageReaderSpi extends ImageReaderSpi {
|
||||
// Copy the bytes read above to the image's data buffer.
|
||||
final int[] a = ((DataBufferInt) bi.getRaster().getDataBuffer()).getData();
|
||||
IntBuffer intBuf = ByteBuffer.wrap(argb).asIntBuffer();
|
||||
assert a.length == intBuf.remaining();
|
||||
if (a.length != intBuf.remaining()) throw new IOException(UNABLE_TO_READ_WEBP_IMAGE);
|
||||
intBuf.get(a);
|
||||
return bi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user