8000 GH-127903: Fix a crash on DEBUG builds when calling `_copy_characters` by shadchin · Pull Request #127876 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-127903: Fix a crash on DEBUG builds when calling _copy_characters #127876

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

Merged
merged 7 commits into from
Jan 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000 Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix comment
  • Loading branch information
shadchin committed Jan 3, 2025
commit 70ca11ab60ffe0639ffddb8023a5a14dbda86594
7 changes: 5 additions & 2 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,10 +1430,13 @@ _copy_characters(PyObject *to, Py_ssize_t to_start,
assert(from_start + how_many <= PyUnicode_GET_LENGTH(from));

assert(to == NULL || PyUnicode_Check(to));
assert(how_many == 0 || (to_start + how_many <= PyUnicode_GET_LENGTH(to)));

if (how_many == 0)
if (how_many == 0) {
return 0;
}

assert(to != NULL);
assert(to_start + how_many <= PyUnicode_GET_LENGTH(to));

from_kind = PyUnicode_KIND(from);
from_data = PyUnicode_DATA(from);
Expand Down
Loading
0