The initialization function of a device plugin has no way of reporting failure
to its called. So an attempt to use the x11 back end calls xlib_finalize() even
if xlib_initialize() failed. To make this safe, we set a flag if initialization
succeeds and make xlib_finalize() a no-op if the flag is not set. Fixes #1776.
- heap-over-flow(off-by-null) in lib/common/shapes.c #1700
- Windows MSBuild executables have the wrong version #1745
- Cast Overflow at pango_textlayout #1314
+- x11 back end segfaults if display is unavailable #1776
## [2.44.1] - 2020-06-29
}
#endif
+static boolean initialized;
+
static void xlib_initialize(GVJ_t *firstjob)
{
Display *dpy;
firstjob->device_dpi.x = DisplayWidth(dpy, scr) * 25.4 / DisplayWidthMM(dpy, scr);
firstjob->device_dpi.y = DisplayHeight(dpy, scr) * 25.4 / DisplayHeightMM(dpy, scr);
firstjob->device_sets_dpi = TRUE;
+
+ initialized = TRUE;
}
static void xlib_finalize(GVJ_t *firstjob)
}
#endif
+ /* skip if initialization previously failed */
+ if (!initialized) {
+ return;
+ }
+
numfds = xlib_fd = XConnectionNumber(dpy);
if (firstjob->input_filename) {