This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][ExpressionParser] Fix indices inside format-strings passed to LLDB_LOG
ClosedPublic

Authored by Michael137 on Jun 17 2022, 8:13 AM.

Details

Summary

llvm::formatv expects the parameter indexes to start with 0.
Unfortunately it doesn't detect out-of-bounds accesses in the format
string at compile-time, of which we had several inside ClangExpressionDeclMap.

This patch fixes these out-of-bounds format accesses.

Example output

  • Before
ClangExpressionDeclMap::FindExternalVisibleDecls for '$__lldb_class' in a
'TranslationUnit'
  CEDM::FEVD Searching the root namespace
  CEDM::FEVD Adding type for $__lldb_class: 1
  • After
ClangExpressionDeclMap::FindExternalVisibleDecls for '$__lldb_class' in
a 'TranslationUnit'
  CEDM::FEVD Searching the root namespace
  CEDM::FEVD Adding type for $__lldb_class: class (lambda)

Diff Detail

Event Timeline

Michael137 created this revision.Jun 17 2022, 8:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2022, 8:13 AM
Herald added a subscriber: arphaman. · View Herald Transcript
Michael137 requested review of this revision.Jun 17 2022, 8:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2022, 8:13 AM
Michael137 retitled this revision from [LLDB][ExpressionParser] Fix indexing into LLDB_LOG calls to [LLDB][ExpressionParser] Fix indexing in LLDB_LOG calls.Jun 17 2022, 8:15 AM
Michael137 edited the summary of this revision. (Show Details)
Michael137 retitled this revision from [LLDB][ExpressionParser] Fix indexing in LLDB_LOG calls to [LLDB][ExpressionParser] Fix indexes inside format-strings passed to LLDB_LOG.Jun 17 2022, 8:15 AM
Michael137 edited the summary of this revision. (Show Details)
Michael137 retitled this revision from [LLDB][ExpressionParser] Fix indexes inside format-strings passed to LLDB_LOG to [LLDB][ExpressionParser] Fix indices inside format-strings passed to LLDB_LOG.Jun 17 2022, 8:16 AM
Michael137 edited the summary of this revision. (Show Details)Jun 17 2022, 8:19 AM
This revision is now accepted and ready to land.Jun 17 2022, 8:50 AM
aprantl accepted this revision.Jun 17 2022, 9:14 AM