diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-08-03 22:02:07 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-08-03 22:02:07 +0000 |
commit | 757640b15625eadd28a4cd6a24c23f66c13db0dc (patch) | |
tree | 647a914acc73896fa9324657e56bb96d7935ccff /libcxxabi/src | |
parent | c934daba9b7d285bf693817f7af5fff3b5de38d0 (diff) | |
download | bcm5719-llvm-757640b15625eadd28a4cd6a24c23f66c13db0dc.tar.gz bcm5719-llvm-757640b15625eadd28a4cd6a24c23f66c13db0dc.zip |
Fixes apple: #12020687. This was a problem in the demangler with template
substitution forward references. That is, sometimes a mangled name refers to
a substitution that hasn't yet been defined. The demangler was derferencing a
null pointer in this case because it wasn't properly guarded against a
forward reference. Test case added to catch this problem.
llvm-svn: 161267
Diffstat (limited to 'libcxxabi/src')
-rw-r--r-- | libcxxabi/src/cxa_demangle.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libcxxabi/src/cxa_demangle.cpp b/libcxxabi/src/cxa_demangle.cpp index d7f383eaed0..b46a0581f58 100644 --- a/libcxxabi/src/cxa_demangle.cpp +++ b/libcxxabi/src/cxa_demangle.cpp @@ -17,7 +17,6 @@ #include <algorithm> #include <assert.h> - #ifdef DEBUGGING #include <string> @@ -3701,6 +3700,8 @@ public: } virtual bool is_function() const { + if (__left_ == 0) + return false; return __left_->is_function(); } virtual bool is_cv_qualifer() const @@ -9196,7 +9197,7 @@ __demangle_tree::__parse_operator_name(const char* first, const char* last, int* case 'v': // cast <type> { - const char* t = __parse_type(first+2, last, false); + const char* t = __parse_type(first+2, last, false, true); if (t != first+2) { __node* cast_type = __root_; |