dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0112-json-parser-Fix-potential-NULL-pointer-segfault.patch

5544c1
From f6df33dc89bfa16645e3a8b76e9457986c07b271 Mon Sep 17 00:00:00 2001
5544c1
From: Stefan Weil <sw@weilnetz.de>
5544c1
Date: Mon, 3 Sep 2012 21:19:11 +0200
5544c1
Subject: [PATCH] json-parser: Fix potential NULL pointer segfault
5544c1
5544c1
Report from smatch:
5544c1
json-parser.c:474 parse_object(62) error: potential null derefence 'dict'.
5544c1
json-parser.c:553 parse_array(75) error: potential null derefence 'list'.
5544c1
5544c1
Label 'out' in json-parser.c can be called with list == NULL
5544c1
which is passed to QDECREF.
5544c1
5544c1
Modify QDECREF to handle a NULL argument (inline function qobject_decref
5544c1
already handles them, too).
5544c1
5544c1
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5544c1
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
5544c1
(cherry picked from commit 149474c93490e1c66f838391bd491db83136d91d)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 qobject.h | 2 +-
5544c1
 1 file changed, 1 insertion(+), 1 deletion(-)
5544c1
5544c1
diff --git a/qobject.h b/qobject.h
5544c1
index d42386d..9124649 100644
5544c1
--- a/qobject.h
5544c1
+++ b/qobject.h
5544c1
@@ -71,7 +71,7 @@ typedef struct QObject {
5544c1
 
5544c1
 /* High-level interface for qobject_decref() */
5544c1
 #define QDECREF(obj)              \
5544c1
-    qobject_decref(QOBJECT(obj))
5544c1
+    qobject_decref(obj ? QOBJECT(obj) : NULL)
5544c1
 
5544c1
 /* Initialize an object to default values */
5544c1
 #define QOBJECT_INIT(obj, qtype_type)   \
5544c1
-- 
5544c1
1.7.12.1
5544c1