From 2d41a7d1b08c6a4a123d23cea3fba689043cfecd Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sat, 5 Oct 2019 12:00:54 -0700 Subject: [PATCH] Fix use-after-free in XConnection::get_output_info (#1211) --- CHANGELOG.md | 1 + src/platform_impl/linux/x11/util/randr.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c780b6b..e92fb8fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Removed `derivative` crate dependency. - On Wayland, add support for set_cursor_icon. - Use `impl Iterator` instead of `AvailableMonitorsIter` consistently. +- On X11, fix use-after-free during window creation # 0.20.0 Alpha 3 (2019-08-14) diff --git a/src/platform_impl/linux/x11/util/randr.rs b/src/platform_impl/linux/x11/util/randr.rs index 1fbef41d..28fcb601 100644 --- a/src/platform_impl/linux/x11/util/randr.rs +++ b/src/platform_impl/linux/x11/util/randr.rs @@ -99,7 +99,8 @@ impl XConnection { // video mode is returned to the user monitor: None, } - }); + }) + .collect(); let name_slice = slice::from_raw_parts( (*output_info).name as *mut u8, @@ -119,7 +120,7 @@ impl XConnection { }; (self.xrandr.XRRFreeOutputInfo)(output_info); - Some((name, hidpi_factor, modes.collect())) + Some((name, hidpi_factor, modes)) } pub fn set_crtc_config(&self, crtc_id: RRCrtc, mode_id: RRMode) -> Result<(), ()> { unsafe {