[Lldb-commits] [PATCH] D75200: AddressSanitizer failure in MemoryCache

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 26 11:23:24 PST 2020


clayborg added a comment.

Not sure this is the right fix. The calling code should listen to how many bytes were actually read from memory and avoid touching any bytes. So we should fix Module::GetMemoryObjectFile to resize its buffer back to only the size that was read. Something like:

  const size_t bytes_read =
      process_sp->ReadMemory(header_addr, data_up->GetBytes(),
                             data_up->GetByteSize(), readmem_error);
  if (bytes_read < size_to_read)
    data_sp->SetByteSize(bytes_read);
  if (data_sp->GetByteSize() > 0) {
    DataBufferSP data_sp(data_up.release());
    m_objfile_sp = ObjectFile::FindPlugin(shared_from_this(), process_sp,
                                          header_addr, data_sp);


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75200/new/

https://reviews.llvm.org/D75200





More information about the lldb-commits mailing list