[all-commits] [llvm/llvm-project] eb2104: [libunwind] Avoid reading OOB for non-existent .eh...

Alexander Richardson via All-commits all-commits at lists.llvm.org
Wed Oct 11 11:46:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eb21049b4b904b072679ece60e73c6b0dc0d1ebf
      https://github.com/llvm/llvm-project/commit/eb21049b4b904b072679ece60e73c6b0dc0d1ebf
  Author: Alexander Richardson <alexrichardson at google.com>
  Date:   2023-10-11 (Wed, 11 Oct 2023)

  Changed paths:
    M libunwind/src/EHHeaderParser.hpp

  Log Message:
  -----------
  [libunwind] Avoid reading OOB for non-existent .eh_frame_hdr (#68815)

I was running the tests with baremetal picolibc which has a linker
script that __eh_frame_start==__eh_frame_end (not equal to zero) in
case there is no .eh_frame_hdr.
I noticed that libunwind was trying to read nonsense data because it
was printing messages such as
`libunwind: unsupported .eh_frame_hdr version: 20 at
https://github.com/llvm/llvm-project/commit/8000d308146ebf49cb364cb600e28a0a42e22c83`

This change adds a ehHdr size check to avoid reading this out-of-bounds
data and potentially crashing.




More information about the All-commits mailing list