[all-commits] [llvm/llvm-project] 77b6ef: [ADT] [lld-macho] Check for end iterator deref in ...

Daniel Bertalan via All-commits all-commits at lists.llvm.org
Tue Jun 21 12:50:13 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77b6efbd8290b4799b69bdbf93e22d30836a16b4
      https://github.com/llvm/llvm-project/commit/77b6efbd8290b4799b69bdbf93e22d30836a16b4
  Author: Daniel Bertalan <dani at danielbertalan.dev>
  Date:   2022-06-21 (Tue, 21 Jun 2022)

  Changed paths:
    M lld/MachO/InputFiles.cpp
    A lld/test/MachO/dwarf-no-compile-unit.s
    M llvm/include/llvm/ADT/STLExtras.h

  Log Message:
  -----------
  [ADT] [lld-macho] Check for end iterator deref in filter_iterator_base

If ld64.lld was supplied an object file that had a `__debug_abbrev` or
`__debug_str` section, but didn't have any compile unit DIEs in
`__debug_info`, it would dereference an iterator pointing to the empty
array of DIEs. This underlying issue started causing segmentation faults
when parsing for `__debug_info` was addded in D128184. That commit was
reverted, and this one fixes the invalid dereference to allow relanding
it.

This commit adds an assertion to `filter_iterator_base`'s dereference
operators to catch bugs like this one.

Ran check-llvm, check-clang and check-lld.

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




More information about the All-commits mailing list