gh-143005: prevent incompatible __class__ reassignment for ctypes arrays#143907
gh-143005: prevent incompatible __class__ reassignment for ctypes arrays#143907VanshAgarwal24036 wants to merge 11 commits intopython:mainfrom
Conversation
59929a5 to
d17521c
Compare
|
@serhiy-storchaka |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Thank you for your PR, @VanshAgarwal24036. I did not know what to do with this issue. It seems that adding check in tp_setattro is the way to go. But I suspect we need more tests -- each condition should be covered by alternate tests,
|
What if we simply expose |
|
There are problems with such special names. If we expose |
|
Arf yes you are right. It just feels to me that it is an overkill but I do not think we have a better alternative, do we? |
|
Thanks for the discussion I agree exposing Given that validating reassignment in |
|
@serhiy-storchaka Do i add more test case as we discuss or how to proceed? |
|
Are there tests for Since there are changes in |
|
@serhiy-storchaka Please review it |
This PR fixes a heap buffer overflow in ctypes arrays caused by assigning
class to an incompatible array type.
The change rejects class reassignment when the new array type differs
in length, size, or element type, preventing out-of-bounds memory access.
A regression test is included.
__class__swap #143005