[PATCH] D33393: [PATCH] Libcxxabi Demangler PR32890

Marcel Boehme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 22 01:02:37 PDT 2017


marcel created this revision.

Check whether the string (db.names.back().first) is longer than 7 characters before inserting another string at index 8.


https://reviews.llvm.org/D33393

Files:
  CREDITS.TXT
  src/cxa_demangle.cpp
  test/test_demangle.pass.cpp


Index: test/test_demangle.pass.cpp
===================================================================
--- test/test_demangle.pass.cpp
+++ test/test_demangle.pass.cpp
@@ -29665,6 +29665,7 @@
     "\x44\x74\x70\x74\x71\x75\x32\x43\x41\x38\x65\x6E\x9B\x72\x4D\xC1\x43\x41\x72\x4D\x6E\x77\x38\x9A\x8E\x44\x6F\x64\x6C\x53\xF9\x5F\x70\x74\x70\x69\x45\x38\xD3\x73\x9E\x2A\x37",
     "\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",
 };
 
 const unsigned NI = sizeof(invalid_cases) / sizeof(invalid_cases[0]);
Index: src/cxa_demangle.cpp
===================================================================
--- src/cxa_demangle.cpp
+++ src/cxa_demangle.cpp
@@ -3075,7 +3075,8 @@
                 const char* t1 = t0 + 1;
                 while (t1 != last && std::isdigit(*t1))
                     ++t1;
-                db.names.back().first.insert(db.names.back().first.begin()+7, t0, t1);
+                if (db.names.back().first.length() > 7)
+                  db.names.back().first.insert(db.names.back().first.begin() + 7, t0, t1);
                 t0 = t1;
             }
             if (t0 == last || *t0 != '_')
Index: CREDITS.TXT
===================================================================
--- CREDITS.TXT
+++ CREDITS.TXT
@@ -12,6 +12,10 @@
 E: aaron at aaronballman.com
 D: Minor patches
 
+N: Marcel Boehme
+E: marcel.boehme at acm.org
+D: Minor patches
+
 N: Logan Chien
 E: logan.chien at mediatek.com
 D: ARM EHABI Unwind & Exception Handling


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33393.99719.patch
Type: text/x-patch
Size: 1685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170522/88940eb4/attachment.bin>


More information about the cfe-commits mailing list