Kaydet (Commit) 0287f2f7 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

check return value of PyString_FromStringAndSize for NULL (closes #24734)

Patch by Pankaj Sharma.
üst 581234ee
......@@ -1979,9 +1979,12 @@ compiler_import(struct compiler *c, stmt_ty s)
identifier tmp = alias->name;
const char *base = PyString_AS_STRING(alias->name);
char *dot = strchr(base, '.');
if (dot)
if (dot) {
tmp = PyString_FromStringAndSize(base,
dot - base);
if (tmp == NULL)
return 0;
}
r = compiler_nameop(c, tmp, Store);
if (dot) {
Py_DECREF(tmp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment