[Lldb-commits] [PATCH] D66442: Fix use-after-free
Matthias Gehre via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 19 14:23:52 PDT 2019
mgehre created this revision.
mgehre added reviewers: jingham, JDevlieghere.
Herald added a project: LLDB.
The warning
lldb/source/Core/FormatEntity.cpp:2350:25: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling]
is emitted after annotating `llvm::StringRef` with `[[gsl::Pointer]]`.
The reason is that in
size_t FormatEntity::AutoComplete(CompletionRequest &request) {
llvm::StringRef str = request.GetCursorArgumentPrefix().str();
the function `GetCursorArgumentPrefix()` returns a `StringRef`, and `StringRef::str()` returns
a temporary `std::string`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D66442
Files:
lldb/source/Core/FormatEntity.cpp
Index: lldb/source/Core/FormatEntity.cpp
===================================================================
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -2347,7 +2347,7 @@
}
size_t FormatEntity::AutoComplete(CompletionRequest &request) {
- llvm::StringRef str = request.GetCursorArgumentPrefix().str();
+ llvm::StringRef str = request.GetCursorArgumentPrefix();
request.SetWordComplete(false);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66442.215985.patch
Type: text/x-patch
Size: 442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190819/87777c07/attachment-0001.bin>
More information about the lldb-commits
mailing list