<AWT Dev> <AWT dev>[9] Review request for 8151333: Some AWT functions may access an array outside of its bounds

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Apr 8 10:57:42 UTC 2016


An additional information from the offline discussion:

>>   - Should the similar check be applied to
>> enumDisplayModes()/configDisplayMode()?

The code which was changed in the fix(screen < ScreenCount was added):

Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode(...jint screen) {
........
     if (screen < ScreenCount(awt_display)) {
         config = awt_XRRGetScreenInfo(awt_display,
                                       RootWindow(awt_display, screen));
         if (config != NULL) {
........
}

The code in enumDisplayModes/configDisplayMode looks similar:

Java_sun_awt_X11GraphicsDevice_enumDisplayModes(...jint screen...) {
........
     config = awt_XRRGetScreenInfo(awt_display,
                                   RootWindow(awt_display, screen));
     if (config != NULL) {
........
}

and
Java_sun_awt_X11GraphicsDevice_configDisplayMode(...jint screen...)
{
........
     root = RootWindow(awt_display, screen);
     config = awt_XRRGetScreenInfo(awt_display, root);
     if (config != NULL) {
........
}
====================================================================
>> Should we use awt_numScreens instead of XScreenCount()? seems that
>> the XScreenCount is used in non-Xinerama code? but awt_numScreens is
>> initialized in both cases?

But in the fix we compare the screenid in xinerama mode and the 
Xinerama-unaware number os screens. It is like compare the apple and juces?

> It is unclear do we really support display modes on non-main screen in
> case of Xinerama, or it is unsupported on unix? Also looks strange that
> we pass to java the screen number which is outside of our internal
> native structure.

I guess that we simply unsupport display modes on non main display(other 
than the current screen res) in xinerama mode.

-- 
Best regards, Sergey.


More information about the awt-dev mailing list