mirror of
https://github.com/python/cpython.git
synced 2025-11-15 16:09:29 +00:00
Fix upsizing of marks stack in pickle module. (GH-8860)
Previously marks stack was upsized even there was space for additional item.
This commit is contained in:
parent
c406d5cd74
commit
86b89916d1
2 changed files with 4 additions and 4 deletions
|
|
@ -309,9 +309,9 @@ if has_c_implementation:
|
||||||
return data
|
return data
|
||||||
check_unpickler(recurse(0), 32, 0)
|
check_unpickler(recurse(0), 32, 0)
|
||||||
check_unpickler(recurse(1), 32, 20)
|
check_unpickler(recurse(1), 32, 20)
|
||||||
check_unpickler(recurse(20), 32, 58)
|
check_unpickler(recurse(20), 32, 20)
|
||||||
check_unpickler(recurse(50), 64, 58)
|
check_unpickler(recurse(50), 64, 60)
|
||||||
check_unpickler(recurse(100), 128, 134)
|
check_unpickler(recurse(100), 128, 140)
|
||||||
|
|
||||||
u = unpickler(io.BytesIO(pickle.dumps('a', 0)),
|
u = unpickler(io.BytesIO(pickle.dumps('a', 0)),
|
||||||
encoding='ASCII', errors='strict')
|
encoding='ASCII', errors='strict')
|
||||||
|
|
|
||||||
|
|
@ -6288,7 +6288,7 @@ load_mark(UnpicklerObject *self)
|
||||||
* mark stack.
|
* mark stack.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((self->num_marks + 1) >= self->marks_size) {
|
if (self->num_marks >= self->marks_size) {
|
||||||
size_t alloc;
|
size_t alloc;
|
||||||
|
|
||||||
/* Use the size_t type to check for overflow. */
|
/* Use the size_t type to check for overflow. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue