Skip to content

Commit

Permalink
Account for PyUnicode_AsUTF8AndSize possibly returning NULL.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachaa-Thanasius authored May 10, 2024
1 parent a682489 commit a6afcda
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions audioop/_audioop.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ _LTS_PyArg_BadArgument(const char *fname, const char *displayname,
}

const char *arg_type_name_chars = PyUnicode_AsUTF8AndSize(arg_type_name, NULL);
if (arg_type_name_chars == NULL) {
Py_DECREF(arg_type_name);
Py_DECREF(arg_type);
return;
}

PyErr_Format(PyExc_TypeError,
"%.200s() %.200s must be %.50s, not %.50s",
Expand Down

0 comments on commit a6afcda

Please sign in to comment.