JDK-8239819 : XToolkit: Misread of screen information memory
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2020-02-22
  • Updated: 2021-11-29
  • Resolved: 2020-04-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15 JDK 8 Other
11.0.15-oracleFixed 13.0.4Fixed 15 b19Fixed 8u331Fixed openjdk8u272Fixed
Related Reports
Relates :  
Relates :  
Description
The XAWT for some native structures uses special java wrappers. These wrappers have to be created on top of the native pointer and provide access to the native fields directly w/o JNI methods.

We have incorrect usage of such wrapper in the XToolkit class:
Toolkit creates AwtScreenData wrapper on top of the XToolkit.getDefaultScreenData()
https://hg.openjdk.java.net/jdk/jdk/file/321b6fbe6815/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java#l344

But unfortunately, this native method returns the wrong pointer to getDefaultConfig():
https://hg.openjdk.java.net/jdk/jdk/file/321b6fbe6815/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c#l134

getScreenData() should be used instead of getDefaultConfig() since native data for default configuration is bigger than screen data we most of the time read some "random" information about visual info.
Comments
Fix request (13u) Need it in 13u as well: the patch applies cleanly with a copyright year exception.
09-06-2020

Backport request to jdk8u-dev: The patch applies cleanly as is with the exception of the copyright header in XToolkit.c and a line difference in XToolkit.java, request for review sent: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2020-May/011788.html
25-05-2020

Backport request to jdk11u-dev: The patch applies cleanly as is with the exception of the copyright header in XToolkit.c
18-05-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/46a1a171cf8b User: psadhukhan Date: 2020-04-11 05:04:11 +0000
11-04-2020

URL: https://hg.openjdk.java.net/jdk/client/rev/46a1a171cf8b User: serb Date: 2020-04-08 17:51:50 +0000
08-04-2020