bpo-34656: Avoid relying on signed overflow in _pickle memos.#9261
Merged
bpo-34656: Avoid relying on signed overflow in _pickle memos.#9261
Conversation
ea95daa to
59c974e
Compare
sir-sigurd
reviewed
Sep 14, 2018
Modules/_pickle.c
Outdated
| @@ -7061,7 +7057,7 @@ Unpickler_set_memo(UnpicklerObject *self, PyObject *obj) | |||
| error: | |||
| if (new_memo_size) { | |||
| i = new_memo_size; | |||
Contributor
There was a problem hiding this comment.
It looks like this line is redundant now.
Modules/_pickle.c
Outdated
|
|
||
| /* Find the smallest valid table size >= min_size. */ | ||
| while (new_size < min_size && new_size > 0) | ||
| while (new_size < min_size) |
Member
There was a problem hiding this comment.
Wouldn't this cause an infinite loop if min_size > PY_SSIZE_T_MAX?
sir-sigurd
reviewed
Sep 15, 2018
Modules/_pickle.c
Outdated
| */ | ||
| if (!(self->mt_used * 3 >= (self->mt_mask + 1) * 2)) | ||
| size_t triple_used = self->mt_used * 3; | ||
| if (triple_used > self->mt_used && triple_used < self->mt_allocated * 2) |
Contributor
There was a problem hiding this comment.
triple_used > self->mt_used
Is this a wrapping/overflow detection?
7975314 to
d8b389b
Compare
Contributor
|
Thanks @benjaminp for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Sep 21, 2018
…ythonGH-9261) (cherry picked from commit a4ae828) Co-authored-by: Benjamin Peterson <benjamin@python.org>
|
GH-9465 is a backport of this pull request to the 3.7 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Sep 21, 2018
…ythonGH-9261) (cherry picked from commit a4ae828) Co-authored-by: Benjamin Peterson <benjamin@python.org>
|
GH-9466 is a backport of this pull request to the 3.6 branch. |
miss-islington
added a commit
that referenced
this pull request
Sep 21, 2018
miss-islington
added a commit
that referenced
this pull request
Sep 21, 2018
larryhastings
pushed a commit
that referenced
this pull request
Feb 25, 2019
larryhastings
pushed a commit
that referenced
this pull request
Feb 26, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue1621