Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea1cf87

Browse files
committed
Issue #29044: Fix a use-after-free in string '%c' formatter.
1 parent c67983b commit ea1cf87

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Objects/unicodeobject.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14213,11 +14213,12 @@ formatchar(PyObject *v)
1421314213
if (iobj == NULL) {
1421414214
goto onError;
1421514215
}
14216-
v = iobj;
14216+
x = PyLong_AsLong(iobj);
1421714217
Py_DECREF(iobj);
1421814218
}
14219-
/* Integer input truncated to a character */
14220-
x = PyLong_AsLong(v);
14219+
else {
14220+
x = PyLong_AsLong(v);
14221+
}
1422114222
if (x == -1 && PyErr_Occurred())
1422214223
goto onError;
1422314224

0 commit comments

Comments
 (0)