[PATCH] D33637: [libcxxabi][demangler] Fix a exponential string copying bug

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 28 16:16:25 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL304113: [demangler] Fix a exponential string copying bug (authored by epilk).

Changed prior to commit:
  https://reviews.llvm.org/D33637?vs=100568&id=100574#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33637

Files:
  libcxxabi/trunk/src/cxa_demangle.cpp
  libcxxabi/trunk/test/test_demangle.pass.cpp


Index: libcxxabi/trunk/src/cxa_demangle.cpp
===================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp
+++ libcxxabi/trunk/src/cxa_demangle.cpp
@@ -2915,6 +2915,10 @@
             ++p0;
             break;
         }
+        if (!isalpha(*p0) && !isdigit(*p0) && *p0 != '_')
+        {
+            return String();
+        }
     }
     return String(p0, pe);
 }
Index: libcxxabi/trunk/test/test_demangle.pass.cpp
===================================================================
--- libcxxabi/trunk/test/test_demangle.pass.cpp
+++ libcxxabi/trunk/test/test_demangle.pass.cpp
@@ -29668,6 +29668,7 @@
     "\x46\x44\x74\x70\x74\x71\x75\x32\x43\x41\x72\x4D\x6E\x65\x34\x9F\xC1\x43\x41\x72\x4D\x6E\x77\x38\x9A\x8E\x44\x6F\x64\x6C\x53\xF9\x5F\x70\x74\x70\x69\x45\x34\xD3\x73\x9E\x2A\x37\x72\x33\x8E\x3A\x29\x8E\x44\x35",
     "_ZcvCiIJEEDvT__FFFFT_vT_v",
     "Z1JIJ1_T_EE3o00EUlT_E0",
+    "___Z2i_D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D",
 };
 
 const unsigned NI = sizeof(invalid_cases) / sizeof(invalid_cases[0]);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33637.100574.patch
Type: text/x-patch
Size: 1089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170528/31e7d895/attachment-0001.bin>


More information about the cfe-commits mailing list