bpo-41654: Fix deallocator of MemoryError to account for subclasses#22020
bpo-41654: Fix deallocator of MemoryError to account for subclasses#22020pablogsal merged 2 commits into
Conversation
e204706 to
faefcf6
Compare
August 31, 2020 11:39
0e25645 to
3941f94
Compare
August 31, 2020 20:31
When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.
vstinner
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the fix @pablogsal!
I tested manually bug.py script attached to https://bugs.python.org/issue41654 : it crashs without the fix, it pass with the fix. I tested Python built in debug mode.
Sorry, something went wrong.
shihai1991
left a comment
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7, 3.8, 3.9. |
Sorry, something went wrong.
|
Sorry @pablogsal, I had trouble checking out the |
Sorry, something went wrong.
|
Sorry, @pablogsal, I could not cleanly backport this to |
Sorry, something went wrong.
|
Sorry @pablogsal, I had trouble checking out the |
Sorry, something went wrong.
|
Sorry, @pablogsal, I could not cleanly backport this to |
Sorry, something went wrong.
|
@pablogsal: I don't think that this change is related to security. Why do you want to backport it to 3.6 and 3.7? https://bugs.python.org/issue41654 type is "crash", not "security". |
Sorry, something went wrong.
I normally qualify segfaults/buffer overflow as security as they can be maliciously used, but it may be a stretch. Let's backport to 3.8 and 3.9 only. |
Sorry, something went wrong.
…sses (pythonGH-22020) When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.. (cherry picked from commit 9b648a9) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
…subclasses (pythonGH-22020) When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.. (cherry picked from commit 9b648a9) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>. (cherry picked from commit 87e91ae) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
…subclasses (GH-22020) (GH-22046) When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.. (cherry picked from commit 9b648a9) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>. (cherry picked from commit 87e91ae) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
…sses (GH-22020) (GH-22045) When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.. (cherry picked from commit 9b648a9) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
…ythonGH-22020) When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.
When allocating MemoryError classes, there is some logic to use
pre-allocated instances in a freelist only if the type that is being
allocated is not a subclass of MemoryError. Unfortunately in the
destructor this logic is not present so the freelist is altered even
with subclasses of MemoryError.
https://bugs.python.org/issue41654