Page MenuHomePhabricator

Fix use-after-free
ClosedPublic

Authored by mgehre on Aug 19 2019, 2:23 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

mgehre created this revision.Aug 19 2019, 2:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2019, 2:23 PM
JDevlieghere accepted this revision.Aug 19 2019, 2:25 PM
This revision is now accepted and ready to land.Aug 19 2019, 2:25 PM
Closed by commit rL369304: Fix use-after-free (authored by mgehre, committed by ). · Explain WhyAug 19 2019, 2:38 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2019, 2:38 PM