JRE-34 IDE Crashes During Startup

Added validation of dpi settings coming from xserver

(cherry picked from commit b1c49c3b27)
This commit is contained in:
Alexey Ushakov
2016-09-20 12:07:24 +03:00
committed by alexey.ushakov@jetbrains.com
parent d015aa34ba
commit 3f4dc38eba

View File

@@ -68,6 +68,7 @@
#define FT26Dot6ToDouble(x) ((x) / ((double) (1<<6)))
#define FT26Dot6ToInt(x) (((int)(x)) >> 6)
#define DEFAULT_DPI 72
#define MAX_DPI 1024
#define ADJUST_FONT_SIZE(X, DPI) (((X)*DEFAULT_DPI + ((DPI)>>1))/(DPI))
#ifndef _WIN32
@@ -249,6 +250,11 @@ static int getScreenResolution(JNIEnv *env) {
(*env)->ExceptionClear(env);
return DEFAULT_DPI;
}
/* Some configurations report invalid dpi settings */
if (dpi > MAX_DPI) {
return DEFAULT_DPI;
}
return dpi;
}