diff options
author | Dong-hee Na <donghee.na@python.org> | 2021-10-11 11:08:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 11:08:38 (GMT) |
commit | 560a79f94e94de66a18f2a5e4194c2fe51e2adf1 (patch) | |
tree | 0e59dd124930ecfc00fc8a8a171be54f310c78ed /Python | |
parent | ab62051152cb24470056ffaeb9107c8b4311375e (diff) | |
download | cpython-560a79f94e94de66a18f2a5e4194c2fe51e2adf1.zip cpython-560a79f94e94de66a18f2a5e4194c2fe51e2adf1.tar.gz cpython-560a79f94e94de66a18f2a5e4194c2fe51e2adf1.tar.bz2 |
Handle error when PyUnicode_GetLength returns a negative value. (GH-28859)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/importdl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/importdl.c b/Python/importdl.c index 27ffc64..3d9cd1a 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -42,6 +42,9 @@ get_encoded_name(PyObject *name, const char **hook_prefix) { /* Get the short name (substring after last dot) */ name_len = PyUnicode_GetLength(name); + if (name_len < 0) { + return NULL; + } lastdot = PyUnicode_FindChar(name, '.', 0, name_len, -1); if (lastdot < -1) { return NULL; |