cpython (merge 3.4 -> 3.5): Fixed reference leak when read truncated pickle.
https://hg.python.org/cpython/rev/f0469025df14 changeset: 99397:f0469025df14 branch: 3.5 parent: 99394:fecb07050aae parent: 99396:67b341701f5e user: Serhiy Storchaka <storchaka@gmail.com> date: Tue Dec 01 00:20:36 2015 +0200 summary: Fixed reference leak when read truncated pickle. files: Modules/_pickle.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -5184,8 +5184,10 @@ return -1; if ((len = _Unpickler_Readline(self, &s)) >= 0) { - if (len < 2) + if (len < 2) { + Py_DECREF(module_name); return bad_readline(); + } class_name = PyUnicode_DecodeASCII(s, len - 1, "strict"); if (class_name != NULL) { cls = find_class(self, module_name, class_name); -- Repository URL: https://hg.python.org/cpython
participants (1)
-
serhiy.storchaka