From 0bad4d63c654d93e1f32ff35026405a3987db5ca Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Tue, 23 Jan 2018 16:26:07 -0500 Subject: [PATCH] bpo-32436: Fix potential NULL dereference (#5286) --- Python/hamt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/hamt.c b/Python/hamt.c index eb69fdd136b..af3dfce43c8 100644 --- a/Python/hamt.c +++ b/Python/hamt.c @@ -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 */