diff options
author | wm4 <wm4@nowhere> | 2016-10-04 16:36:20 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-10-04 16:36:20 +0200 |
commit | 202f14aa29e273d93aecb90e81f2e0b6426a7be7 (patch) | |
tree | fa4e2629bb4f304333b550528a7c5ea6ea00e509 /video/out | |
parent | 75cab315ea3b6bb8858368f5df504dec0e683967 (diff) | |
download | mpv-202f14aa29e273d93aecb90e81f2e0b6426a7be7.tar.bz2 mpv-202f14aa29e273d93aecb90e81f2e0b6426a7be7.tar.xz |
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.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/opengl/hwdec_rpi.c | 4 |
1 files changed, 3 insertions, 1 deletions
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]; |