diff options
author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2018-08-25 07:54:40 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-08-25 07:54:40 (GMT) |
commit | 86b89916d1b0a26c1e77f53b68829ca583425054 (patch) | |
tree | 125dcd957579f0932e8788e9fa6b8474311d76ee | |
parent | c406d5cd74002964a64c3eb7d9e2445a7fd3a03f (diff) | |
download | cpython-86b89916d1b0a26c1e77f53b68829ca583425054.zip cpython-86b89916d1b0a26c1e77f53b68829ca583425054.tar.gz cpython-86b89916d1b0a26c1e77f53b68829ca583425054.tar.bz2 |
Fix upsizing of marks stack in pickle module. (GH-8860)
Previously marks stack was upsized even there was space for additional item.
-rw-r--r-- | Lib/test/test_pickle.py | 6 | ||||
-rw-r--r-- | Modules/_pickle.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index 0051a01..b4bce7e 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -309,9 +309,9 @@ if has_c_implementation: return data check_unpickler(recurse(0), 32, 0) check_unpickler(recurse(1), 32, 20) - check_unpickler(recurse(20), 32, 58) - check_unpickler(recurse(50), 64, 58) - check_unpickler(recurse(100), 128, 134) + check_unpickler(recurse(20), 32, 20) + check_unpickler(recurse(50), 64, 60) + check_unpickler(recurse(100), 128, 140) u = unpickler(io.BytesIO(pickle.dumps('a', 0)), encoding='ASCII', errors='strict') diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 517c99e..39628fc 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6288,7 +6288,7 @@ load_mark(UnpicklerObject *self) * mark stack. */ - if ((self->num_marks + 1) >= self->marks_size) { + if (self->num_marks >= self->marks_size) { size_t alloc; /* Use the size_t type to check for overflow. */ |