From d66549f6f6097f1bb11e7b8b1be404c0ef1bb9de Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Wed, 27 Jan 2016 14:12:05 +0530 Subject: [PATCH] 8147077: IllegalArgumentException thrown by api/java_awt/Component/FlipBufferStrategy/indexTGF_General Reviewed-by: flar, arapte --- .../unix/classes/sun/awt/X11GraphicsConfig.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java index 1b3c4fa2e23..27b97818dee 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java @@ -452,8 +452,12 @@ public class X11GraphicsConfig extends GraphicsConfiguration public VolatileImage createBackBufferImage(Component target, long backBuffer) { + // it is possible for the component to have size 0x0, adjust it to + // be at least 1x1 to avoid IAE + int w = Math.max(1, target.getWidth()); + int h = Math.max(1, target.getHeight()); return new SunVolatileImage(target, - target.getWidth(), target.getHeight(), + w, h, Long.valueOf(backBuffer)); }