| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Fix missing error checks for calls to ``PyList_Append`` in ``_PyEval_MatchClass``. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1060,7 +1060,9 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, | |||
| 1060 | 1060 | } | |
| 1061 | 1061 | if (match_self) { | |
| 1062 | 1062 | // Easy. Copy the subject itself, and move on to kwargs. | |
| 1063 | - PyList_Append(attrs, subject); | ||
| 1063 | + if (PyList_Append(attrs, subject) < 0) { | ||
| 1064 | + goto fail; | ||
| 1065 | + } | ||
| 1064 | 1066 | } | |
| 1065 | 1067 | else { | |
| 1066 | 1068 | for (Py_ssize_t i = 0; i < nargs; i++) { | |
@@ -1076,7 +1078,10 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, | |||
| 1076 | 1078 | if (attr == NULL) { | |
| 1077 | 1079 | goto fail; | |
| 1078 | 1080 | } | |
| 1079 | - PyList_Append(attrs, attr); | ||
| 1081 | + if (PyList_Append(attrs, attr) < 0) { | ||
| 1082 | + Py_DECREF(attr); | ||
| 1083 | + goto fail; | ||
| 1084 | + } | ||
| 1080 | 1085 | Py_DECREF(attr); | |
| 1081 | 1086 | } | |
| 1082 | 1087 | } | |
@@ -1089,7 +1094,10 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, | |||
| 1089 | 1094 | if (attr == NULL) { | |
| 1090 | 1095 | goto fail; | |
| 1091 | 1096 | } | |
| 1092 | - PyList_Append(attrs, attr); | ||
| 1097 | + if (PyList_Append(attrs, attr) < 0) { | ||
| 1098 | + Py_DECREF(attr); | ||
| 1099 | + goto fail; | ||
| 1100 | + } | ||
| 1093 | 1101 | Py_DECREF(attr); | |
| 1094 | 1102 | } | |
| 1095 | 1103 | Py_SETREF(attrs, PyList_AsTuple(attrs)); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments