From 5fd11ec4a622f1abba9290de863347b6f55de518 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 9 May 2025 14:54:33 +0200 Subject: [PATCH] glamor: NULL-protect GLAMOR_PIXMAP_PRIV_HAS_FBO() It could potentially be called with NULL pointer, but can't handle it, so when that happens, it's a bug. Adding a BUG_RETURN_VAL() call here, so it's giving us a hint where to look at. Signed-off-by: Enrico Weigelt, metux IT consult --- glamor/glamor_utils.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h index bee48d989..a64f4dea7 100644 --- a/glamor/glamor_utils.h +++ b/glamor/glamor_utils.h @@ -32,6 +32,8 @@ #ifndef __GLAMOR_UTILS_H__ #define __GLAMOR_UTILS_H__ +#include "os/bug_priv.h" + #include "glamor_prepare.h" #include "mipict.h" @@ -570,7 +572,10 @@ && (_w_) <= _glamor_->max_fbo_size \ && (_h_) <= _glamor_->max_fbo_size) -#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL) +static inline Bool GLAMOR_PIXMAP_PRIV_HAS_FBO(glamor_pixmap_private *pixmap_priv) { + BUG_RETURN_VAL(!pixmap_priv, FALSE); + return pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL; +} #define REVERT_NONE 0 #define REVERT_NORMAL 1