From 202f14aa29e273d93aecb90e81f2e0b6426a7be7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 4 Oct 2016 16:36:20 +0200 Subject: vo_opengl: hwdec_rpi: fix NULL pointer deref in certain cases If a client API user provides the MPGetNativeDisplay callback, but returns NULL for "MPV_RPI_WINDOW", this would crash. --- video/out/opengl/hwdec_rpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/video/out/opengl/hwdec_rpi.c b/video/out/opengl/hwdec_rpi.c index 0caa01874c..90a350eac1 100644 --- a/video/out/opengl/hwdec_rpi.c +++ b/video/out/opengl/hwdec_rpi.c @@ -136,7 +136,9 @@ static void update_overlay(struct gl_hwdec *hw, bool check_window_only) int defs[4] = {0, 0, 0, 0}; int *z = - gl->MPGetNativeDisplay ? gl->MPGetNativeDisplay("MPV_RPI_WINDOW") : defs; + gl->MPGetNativeDisplay ? gl->MPGetNativeDisplay("MPV_RPI_WINDOW") : NULL; + if (!z) + z = defs; // As documented in the libmpv openglcb headers. int display = z[0]; -- cgit v1.2.3