New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use PyMem_New instead of PyMem_Malloc #67634
Comments
Proposed patch replaces PyMem_Malloc with PyMem_New if the former is used in the form PyMem_Malloc(len * sizeof(type)). This can fix possible overflow errors and makes the code cleaner. |
In _testbuffer.c: ndim <= 64, so the changes aren't really necessary. The reason is of course that even an array with only 2 elements per |
Very nice. I think you should also apply it to older versions, since (as we now) this sort of thing is very liable to cause security problems. |
Indeed, I'll remove these changes.
But an array can be with 1 element per dimension. In any case it is good that there is strict limitation on ndim values. |
Yes, but these (degenerate) arrays tend to arise only as a result of slicing. |
New changeset d83884b3a427 by Serhiy Storchaka in branch '2.7': New changeset 036a2aceae93 by Serhiy Storchaka in branch '3.4': New changeset d12c7938c4b0 by Serhiy Storchaka in branch 'default': |
May be apply the fix to 3.3? |
That would be nice. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: