]> granicus.if.org Git - python/commitdiff
bpo-32436: Fix potential NULL dereference (#5286)
authorYury Selivanov <yury@magic.io>
Tue, 23 Jan 2018 21:26:07 +0000 (16:26 -0500)
committerGitHub <noreply@github.com>
Tue, 23 Jan 2018 21:26:07 +0000 (16:26 -0500)
Python/hamt.c

index eb69fdd136bffbf3a3db87d53039eedbf32cb1de..af3dfce43c89b642f0320acb95786fa5dd845368 100644 (file)
@@ -1055,6 +1055,10 @@ hamt_node_bitmap_without(PyHamtNode_Bitmap *self,
 #endif
 
                 PyHamtNode_Bitmap *clone = hamt_node_bitmap_clone(self);
+                if (clone == NULL) {
+                    return W_ERROR;
+                }
+
                 Py_SETREF(clone->b_array[val_idx],
                           (PyObject *)sub_node);  /* borrow */