summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorFrancis Kung <fkung@redhat.com>2006-10-17 14:53:36 +0000
committerFrancis Kung <fkung@redhat.com>2006-10-17 14:53:36 +0000
commit66c58599e46ab4e84512ad68380d226e8f72bdfb (patch)
treed80225c5a2be81ff9cd0e15f37e505a01c932c13 /java
parent18597d9bc2c587250640c4e5e8e0a4370312afd3 (diff)
downloadclasspath-66c58599e46ab4e84512ad68380d226e8f72bdfb.tar.gz
2006-10-17 Francis Kung <fkung@redhat.com>
* gnu/java/awt/peer/gtk/BufferedImageGraphics.java (drawComposite): Ensure composite does not extend beyond buffer bounds. * java/awt/image/Raster.java (createChild): Ensure child does not extend beyond parent's bounds. * java/awt/image/WritableRaster.java (createWritableChild): Ensure child does not extend beyond parent's bounds.
Diffstat (limited to 'java')
-rw-r--r--java/awt/image/Raster.java7
-rw-r--r--java/awt/image/WritableRaster.java5
2 files changed, 7 insertions, 5 deletions
diff --git a/java/awt/image/Raster.java b/java/awt/image/Raster.java
index 160f8be8b..d63e156f6 100644
--- a/java/awt/image/Raster.java
+++ b/java/awt/image/Raster.java
@@ -511,9 +511,10 @@ public class Raster
int height, int childMinX, int childMinY,
int[] bandList)
{
- /* FIXME: Throw RasterFormatException if child bounds extends
- beyond the bounds of this raster. */
-
+ if (parentX < minX || parentX + width > minX + this.width
+ || parentY < minY || parentY + height > minY + this.height)
+ throw new RasterFormatException("Child raster extends beyond parent");
+
SampleModel sm = (bandList == null) ?
sampleModel :
sampleModel.createSubsetSampleModel(bandList);
diff --git a/java/awt/image/WritableRaster.java b/java/awt/image/WritableRaster.java
index 473c6fe41..d2ea4a8aa 100644
--- a/java/awt/image/WritableRaster.java
+++ b/java/awt/image/WritableRaster.java
@@ -136,8 +136,9 @@ public class WritableRaster extends Raster
{
// This mirrors the code from the super class
- // FIXME: Throw RasterFormatException if child bounds extends
- // beyond the bounds of this raster.
+ if (parentX < minX || parentX + w > minX + width
+ || parentY < minY || parentY + h > minY + height)
+ throw new RasterFormatException("Child raster extends beyond parent");
SampleModel sm = (bandList == null) ?
sampleModel :