From 01f9f2246b1e55c64284a3fe6d5f30de3889c193 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH] graphics/grX11su1.c: Dereference of null pointer Looks like the code below requires w!=NULL to do anything useful. So when w==NULL we don't continue processing X11 Event. SonarCloud graphics/grX11su1.c:842 Dereference of null pointer https://sonarcloud.io/project/issues?open=AZJB163RNGfDNup0Ri4o&id=dlmiles_magic --- graphics/grX11su1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphics/grX11su1.c b/graphics/grX11su1.c index e4485698..560ec71e 100644 --- a/graphics/grX11su1.c +++ b/graphics/grX11su1.c @@ -835,6 +835,8 @@ grX11Stdin() entry = HashLookOnly(&grX11WindowTable,grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; grCurrent.mw=w; + if(!w) + break; screenRect.r_xbot = ExposeEvent->x; screenRect.r_xtop = ExposeEvent->x+ExposeEvent->width;