mirror of
https://github.com/openjdk/jdk7u.git
synced 2025-12-11 13:57:59 -06:00
8272462: Enhance image handling
Reviewed-by: yan
This commit is contained in:
parent
a8484d332d
commit
ebeadc89d3
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -956,6 +956,11 @@ public class GIFImageReader extends ImageReader {
|
||||
}
|
||||
}
|
||||
|
||||
if (tableIndex >= prefix.length) {
|
||||
throw new IIOException("Code buffer limit reached,"
|
||||
+ " no End of Image tag present, possibly data is corrupted. ");
|
||||
}
|
||||
|
||||
int ti = tableIndex;
|
||||
int oc = oldCode;
|
||||
|
||||
|
||||
@ -1082,6 +1082,13 @@ public class JPEGImageReader extends ImageReader {
|
||||
throw new IIOException("Unsupported Image Type");
|
||||
}
|
||||
|
||||
if ((long)width * height > Integer.MAX_VALUE - 2) {
|
||||
// We are not able to properly decode image that has number
|
||||
// of pixels greater than Integer.MAX_VALUE - 2
|
||||
throw new IIOException("Can not read image of the size "
|
||||
+ width + " by " + height);
|
||||
}
|
||||
|
||||
image = getDestination(param, imageTypes, width, height);
|
||||
imRas = image.getRaster();
|
||||
|
||||
|
||||
@ -1239,6 +1239,13 @@ public class PNGImageReader extends ImageReader {
|
||||
int width = metadata.IHDR_width;
|
||||
int height = metadata.IHDR_height;
|
||||
|
||||
if ((long)width * height > Integer.MAX_VALUE - 2) {
|
||||
// We are not able to properly decode image that has number
|
||||
// of pixels greater than Integer.MAX_VALUE - 2
|
||||
throw new IIOException("Can not read image of the size "
|
||||
+ width + " by " + height);
|
||||
}
|
||||
|
||||
// Init default values
|
||||
sourceXSubsampling = 1;
|
||||
sourceYSubsampling = 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user