From acfd73b22c058e73c73684d227ab278935c9c21c Mon Sep 17 00:00:00 2001 From: Steven Wu Date: Mon, 20 Feb 2017 18:33:40 +0000 Subject: [PATCH] Fix use-after-free found by ASAN DenseMap::lookup returns copy of the value in the map. Returning the address of the temporary return value will cause use-after-free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295675 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/DebugCounter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/llvm/Support/DebugCounter.h b/include/llvm/Support/DebugCounter.h index 46138914d0c..ee56ecf39ca 100644 --- a/include/llvm/Support/DebugCounter.h +++ b/include/llvm/Support/DebugCounter.h @@ -111,7 +111,7 @@ public: unsigned int getNumCounters() const { return RegisteredCounters.size(); } // Return the name and description of the counter with the given ID. - std::pair getCounterInfo(unsigned ID) const { + std::pair getCounterInfo(unsigned ID) const { return std::make_pair(RegisteredCounters[ID], CounterDesc.lookup(ID)); } -- 2.50.1