mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Handle error when PyUnicode_GetLength returns a negative value. (GH-28859)
(cherry picked from commit 560a79f94e)
Co-authored-by: Dong-hee Na <donghee.na@python.org>
This commit is contained in:
parent
ac421c348b
commit
7d1ae89b84
1 changed files with 3 additions and 0 deletions
|
|
@ -42,6 +42,9 @@ get_encoded_name(PyObject *name, const char **hook_prefix) {
|
||||||
|
|
||||||
/* Get the short name (substring after last dot) */
|
/* Get the short name (substring after last dot) */
|
||||||
name_len = PyUnicode_GetLength(name);
|
name_len = PyUnicode_GetLength(name);
|
||||||
|
if (name_len < 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
lastdot = PyUnicode_FindChar(name, '.', 0, name_len, -1);
|
lastdot = PyUnicode_FindChar(name, '.', 0, name_len, -1);
|
||||||
if (lastdot < -1) {
|
if (lastdot < -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue