[all-commits] [llvm/llvm-project] fd623b: Fix crash after looking up dwo_id=0 in CU index.

Jorge Gorbe Moya via All-commits all-commits at lists.llvm.org
Wed Nov 25 22:45:08 PST 2020


  Branch: refs/heads/release/11.x
  Home:   https://github.com/llvm/llvm-project
  Commit: fd623ba8061dda6f489390ada6b11dff58a4d470
      https://github.com/llvm/llvm-project/commit/fd623ba8061dda6f489390ada6b11dff58a4d470
  Author: Jorge Gorbe Moya <jgorbe at google.com>
  Date:   2020-11-26 (Thu, 26 Nov 2020)

  Changed paths:
    M llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
    A llvm/test/tools/llvm-symbolizer/split-dwarf-zero-signature-not-found.s

  Log Message:
  -----------
  Fix crash after looking up dwo_id=0 in CU index.

In the current state, if getFromHash(0) is called and there's no CU with
dwo_id=0, the lookup will stop at an empty slot, then the check
`Rows[H].getSignature() != S` won't cause the lookup to fail and return
a nullptr (as it should), because the empty slot has a 0 in the
signature field, and a pointer to the empty slot will be incorrectly
returned.

This patch fixes this by using the index field in the hash entry to
check for empty slots: signature = 0 can match a valid hash but
according to the spec the index for an occupied slot will always be
non-zero.

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

(cherry picked from commit 314a0d73a8444e3b0c1a0d0de7d615d9448af1c9)




More information about the All-commits mailing list