[llvm] r293330 - Fix ASAN failure in cxa_demangle

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 12:32:16 PST 2017


Author: mehdi_amini
Date: Fri Jan 27 14:32:16 2017
New Revision: 293330

URL: http://llvm.org/viewvc/llvm-project?rev=293330&view=rev
Log:
Fix ASAN failure in cxa_demangle

Found with ASAN + libFuzzer by Kostya Serebryany <kcc at google.com>

Modified:
    llvm/trunk/lib/Demangle/ItaniumDemangle.cpp

Modified: llvm/trunk/lib/Demangle/ItaniumDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/ItaniumDemangle.cpp?rev=293330&r1=293329&r2=293330&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/ItaniumDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/ItaniumDemangle.cpp Fri Jan 27 14:32:16 2017
@@ -1402,7 +1402,8 @@ static const char *parse_function_type(c
         int ref_qual = 0;
         while (true) {
           if (t == last) {
-            db.names.pop_back();
+            if (!db.names.empty())
+              db.names.pop_back();
             return first;
           }
           if (*t == 'E') {




More information about the llvm-commits mailing list