[all-commits] [llvm/llvm-project] f000de: [LLDB][ExpressionParser] Fix indices inside format...

Adrian Prantl via All-commits all-commits at lists.llvm.org
Fri Jun 17 09:27:03 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f000de8760c112ead0487a020c3849c6280f2a57
      https://github.com/llvm/llvm-project/commit/f000de8760c112ead0487a020c3849c6280f2a57
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2022-06-17 (Fri, 17 Jun 2022)

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

  Log Message:
  -----------
  [LLDB][ExpressionParser] Fix indices inside format-strings passed to LLDB_LOG

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)

Patch by Michael Buch!

Differential Revision: https://reviews.llvm.org/D128063




More information about the All-commits mailing list