Skip to contentSkip to conversation

ui/spice-display: check NULL pointer in interface_release_resource()

PATCH In review Mauro Matteo Cascella 2 participants 2 messages May 20, 2021 – May 21, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/spice-display: check NULL pointer in interface_release_resource()

Check rext.info to avoid potential NULL pointer dereference. A similar check exists in interface_release_resource() in hw/display/qxl.c.

---
 ui/spice-display.c | 4 ++++
 1 file changed, 4 insertions(+)
ui/spice-display.c +4 -0
index d22781a23d..f59c69882d 100644
@@ -561,6 +561,10 @@ static void interface_release_resource(QXLInstance *sin,
     SimpleSpiceCursor *cursor;
     QXLCommandExt *ext;
 
+    if (!rext.info) {
+        return;
+    }
+
     ext = (void *)(intptr_t)(rext.info->id);
     switch (ext->cmd.type) {
     case QXL_CMD_DRAW:
Signature · 1 line
2.31.1
Reviewed-by Prasad J Pandit on v1 1/1
#1 lore raw
+-- On Thu, 20 May 2021, Mauro Matteo Cascella wrote --+
| diff --git a/ui/spice-display.c b/ui/spice-display.c
| index d22781a23d..f59c69882d 100644
| --- a/ui/spice-display.c
| +++ b/ui/spice-display.c
| @@ -561,6 +561,10 @@ static void interface_release_resource(QXLInstance *sin,
|      SimpleSpiceCursor *cursor;
|      QXLCommandExt *ext;
|  
| +    if (!rext.info) {
| +        return;
| +    }
| +
|      ext = (void *)(intptr_t)(rext.info->id);
|      switch (ext->cmd.type) {
|      case QXL_CMD_DRAW:

Looks okay.

Thank you.
--
- P J P
8685 545E B54C 486B C6EB 271E E285 8B5A F050 DE8D