diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-12-14 20:40:27 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-12-14 20:40:27 +0000 |
commit | 1d9cb8a1844baa3ca3a8912a667364726cf3931e (patch) | |
tree | d1013e63589c3388645c5e990c3acb54449e122c /lldb/scripts/Python/python-wrapper.swig | |
parent | da103bf9ecfcdeb4292b2920c908a416a8b105b4 (diff) | |
download | bcm5719-llvm-1d9cb8a1844baa3ca3a8912a667364726cf3931e.tar.gz bcm5719-llvm-1d9cb8a1844baa3ca3a8912a667364726cf3931e.zip |
http://llvm.org/bugs/show_bug.cgi?id=11569
LLDBSwigPythonCallCommand crashes when a command script returns an object
Add more robustness to LLDBSwigPythonCallCommand. It should check whether the returned Python object
is a string, and only assign it as the error msg when the check holds.
Also add a regression test.
llvm-svn: 146584
Diffstat (limited to 'lldb/scripts/Python/python-wrapper.swig')
-rw-r--r-- | lldb/scripts/Python/python-wrapper.swig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index d68c1b9260c..787074e7fcb 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -645,9 +645,11 @@ LLDBSwigPythonCallCommand err_msg.clear(); retval = true; } - else // return value is an error string + else { - err_msg.assign(PyString_AsString(pvalue)); + // return value is an error string + if (PyString_CheckExact(pvalue)) + err_msg.assign(PyString_AsString(pvalue)); retval = false; } Py_DECREF (pvalue); |