Bug 1545247 - Fix crash in MouseCursorMonitorX11::CaptureCursor() on linux32; r=ng a=jcristau
authorDan Minor <dminor@mozilla.com>
Tue, 28 May 2019 16:03:19 +0000
changeset 536569 4738da99fbc88df4ba50b494b58342d44fa3575b
parent 536568 ab126e9e64632ac6ee92b9ee819cfdc9ec3abd51
child 536570 b9d57ba2bf45a07a5348473a354931c49b580e3f
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersng, jcristau
bugs1545247
milestone68.0
Bug 1545247 - Fix crash in MouseCursorMonitorX11::CaptureCursor() on linux32; r=ng a=jcristau This is a cherry pick of upstream commit c1187ab34bdf836bd33f7f050d525184eba4cd20. Differential Revision: https://phabricator.services.mozilla.com/D32826
media/webrtc/trunk/webrtc/modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc
@@ -206,21 +206,22 @@ void MouseCursorMonitorX11::CaptureCurso
     img = XFixesGetCursorImage(display());
     if (!img || error_trap.GetLastErrorAndDisable() != 0)
        return;
    }
 
    std::unique_ptr<DesktopFrame> image(
        new BasicDesktopFrame(DesktopSize(img->width, img->height)));
 
-  uint64_t* src = reinterpret_cast<uint64_t*>(img->pixels);
+  // Xlib stores 32-bit data in longs, even if longs are 64-bits long.
+  unsigned long* src = img->pixels;
   uint32_t* dst = reinterpret_cast<uint32_t*>(image->data());
   uint32_t* dst_end = dst + (img->width * img->height);
   while (dst < dst_end) {
-    *dst++ = *src++;
+    *dst++ = static_cast<uint32_t>(*src++);
   }
 
   DesktopVector hotspot(std::min(img->width, img->xhot),
                         std::min(img->height, img->yhot));
 
   XFree(img);
 
   cursor_shape_.reset(new MouseCursor(image.release(), hotspot));