[issue38588] Use-after-free in dict/list
Dong-hee Na
report at bugs.python.org
Mon Dec 30 20:37:29 EST 2019
Dong-hee Na <donghee.na92 at gmail.com> added the comment:
Master
Mean +- std dev: 1.08 us +- 0.02 us
Before PR-17734
Mean +- std dev: 584 ns +- 12 ns
New suggested
.....................
Mean +- std dev: 578 ns +- 14 ns
diff --git a/Objects/object.c b/Objects/object.c
index 6fc1146..b42f41a 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -865,6 +865,8 @@ PyObject_RichCompareBool(PyObject *v, PyObject *w, int op)
return 0;
}
+ Py_INCREF(v);
+ Py_INCREF(w);
res = PyObject_RichCompare(v, w, op);
if (res == NULL)
return -1;
@@ -873,6 +875,8 @@ PyObject_RichCompareBool(PyObject *v, PyObject *w, int op)
else
ok = PyObject_IsTrue(res);
Py_DECREF(res);
+ Py_DECREF(v);
+ Py_DECREF(w);
return ok;
}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38588>
_______________________________________
More information about the Python-bugs-list
mailing list