[Python-checkins] cpython (merge 3.4 -> 3.5): Fixed reference leak when read truncated pickle.

serhiy.storchaka python-checkins at python.org
Mon Nov 30 17:21:14 EST 2015


https://hg.python.org/cpython/rev/f0469025df14
changeset: 99397:f0469025df14
branch: 3.5
parent: 99394:fecb07050aae
parent: 99396:67b341701f5e
user: Serhiy Storchaka <storchaka at 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


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /