[PATCH weston 3/4] rpi: avoid segfault in `rpir_view_compute_rects()` when EGL client destroys buffer

John Sadler deathofathousandpapercuts at gmail.com
Sat Sep 5 07:01:39 PDT 2015


This commit works-around a serious issue when running with the RPi backend.
When an EGL client shuts down and destroys it's EGL window, Weston dies with
a segmentation fault in the above function (because `buffer` is now NULL).

The addition of a simple NULL check avoids the problem.

This is a minor re-formatting of the patch already submitted here:

  http://patchwork.freedesktop.org/patch/34885

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85167

Signed-off-by: John Sadler <deathofathousandpapercuts at gmail.com>
---
 src/rpi-renderer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c
index a096033..447234f 100644
--- a/src/rpi-renderer.c
+++ b/src/rpi-renderer.c
@@ -703,8 +703,12 @@ rpir_view_compute_rects(struct rpir_view *view,
 		struct weston_buffer *buffer =
 			view->surface->egl_front->buffer_ref.buffer;
 
+		if (!buffer)
+			return -1;
+
 		src_width = buffer->width << 16;
 		src_height = buffer->height << 16;
+
 	} else {
 		src_width = view->surface->front->width << 16;
 		src_height = view->surface->front->height << 16;
-- 
1.8.1.4



More information about the wayland-devel mailing list