summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Chisnall <dchisnall@pathscale.com>2012-03-10 17:47:44 +0000
committerDavid Chisnall <dchisnall@pathscale.com>2012-03-10 17:47:44 +0000
commit414b9890d0ae192e44db30d0dabb1c03186327dc (patch)
tree65f92961d4d483469282a9a1f151252be24a90b8 /src
parent3b2a9a00dd4267fcffd370390037001f912347a3 (diff)
downloadlibcxxrt-414b9890d0ae192e44db30d0dabb1c03186327dc.tar.gz
libcxxrt-414b9890d0ae192e44db30d0dabb1c03186327dc.tar.bz2
libcxxrt-414b9890d0ae192e44db30d0dabb1c03186327dc.tar.xz
Check for null pointer arguments in demangler.
Diffstat (limited to 'src')
-rw-r--r--src/typeinfo.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/typeinfo.cc b/src/typeinfo.cc
index fab4015..7fb7486 100644
--- a/src/typeinfo.cc
+++ b/src/typeinfo.cc
@@ -65,18 +65,30 @@ extern "C" char* __cxa_demangle(const char* mangled_name,
{
memcpy(buf, demangled, len);
buf[len] = 0;
- *n = len;
- *status = 0;
+ if (n)
+ {
+ *n = len;
+ }
+ if (status)
+ {
+ *status = 0;
+ }
}
else
{
- *status = -1;
+ if (status)
+ {
+ *status = -1;
+ }
}
free(demangled);
}
else
{
- *status = -2;
+ if (status)
+ {
+ *status = -2;
+ }
return NULL;
}
return buf;