diff options
author | Maarten ter Huurne <maarten@boxingbeetle.com> | 2019-02-18 22:51:51 +0100 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2019-02-20 07:17:42 -0800 |
commit | eb9c1d434ba7a904410b954426800fc963986d56 (patch) | |
tree | 498cdd2b42704b825ecafd1db93bd4f914a95f06 /src | |
parent | 0b52aee115f9921d9136da2f9a51b51db1145cb9 (diff) | |
download | markupsafe-eb9c1d434ba7a904410b954426800fc963986d56.tar.gz |
Add NULL check after native call to __html__ method
If the method raises an exception, PyObject_CallObject() returns NULL,
but the code didn't check for that, which led to a segfault.
Fixes #108
Diffstat (limited to 'src')
-rw-r--r-- | src/markupsafe/_speedups.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/markupsafe/_speedups.c b/src/markupsafe/_speedups.c index 22a604d..b27435e 100644 --- a/src/markupsafe/_speedups.c +++ b/src/markupsafe/_speedups.c @@ -311,6 +311,9 @@ escape(PyObject *self, PyObject *text) if (html) { s = PyObject_CallObject(html, NULL); Py_DECREF(html); + if (s == NULL) { + return NULL; + } /* Convert to Markup object */ rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL); Py_DECREF(s); |