[all-commits] [llvm/llvm-project] 3885ce: [LLDB] Fix buffer overflow problem in DWARFExpress...

cmtice via All-commits all-commits at lists.llvm.org
Mon Jul 10 19:48:14 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3885ceafa9347dd729eba5cf872091a689b63d98
      https://github.com/llvm/llvm-project/commit/3885ceafa9347dd729eba5cf872091a689b63d98
  Author: Caroline Tice <cmtice at google.com>
  Date:   2023-07-10 (Mon, 10 Jul 2023)

  Changed paths:
    M lldb/source/Expression/DWARFExpression.cpp

  Log Message:
  -----------
  [LLDB] Fix buffer overflow problem in DWARFExpression::Evaluate

In two calls to ReadMemory in DWARFExpression.cpp, the buffer size
passed to ReadMemory is not checked and can be bigger than the actual
size of the buffer. This caused a buffer overflow bug, which we
found through Address Sanitizer. This patch fixes the problem by
checking the address size when it is first read out of the DWARF, and
setting an error and returning immediatley if the size is invalid.

This is the second attempt to fix this issue; I reverted the first one,
as it was not quite correct.

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




More information about the All-commits mailing list