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
PyUnicode_CopyCharacters could lead to undefined behaviour #72565
Comments
Currently PyUnicode_CopyCharacters doesn't check arguments thoroughly. This could lead to undefined behaviour or crash in debug mode. For example, from_start > len(from), how_many < 0. Another case is that when how_many > len(from), it will choose len(from) but this can still fail since from_start can > 0. The doc of it is also not perfect, it does not necessarily return 0 on success. |
Added comments on Rietveld. I don't know whether tests for this function are needed. It is public, but is not a part of stable API. |
v2 applies Serhiy's suggestions. |
New changeset 13addd71b751 by Serhiy Storchaka in branch '3.5': |
Thank you for your contribution. |
Thanks Serhiy! But sorry I think I have made a mistake. In unicode_copycharacters we don't need PyUnicode_READY since it has been done in argument parse. Could you remove it? |
New changeset 1be8cd7cee92 by Serhiy Storchaka in branch 'default': |
We don't need to remove it for 3.5 and 3.6? |
This is just a cleaning up of not very important code. |
Fine. :-) |
Misc/NEWS
so that it is managed by towncrier #552Note: 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: