]> Cypherpunks repositories - gostls13.git/commitdiff
debug/dwarf: better error message when reading absent debug_line_str
authorAlessandro Arzilli <alessandro.arzilli@gmail.com>
Mon, 15 Nov 2021 08:42:28 +0000 (09:42 +0100)
committerIan Lance Taylor <iant@golang.org>
Mon, 15 Nov 2021 23:55:09 +0000 (23:55 +0000)
When a DW_FORM_line_strp is used without a debug_line_str section a
good error message (about the missing section) is generated but
immediately overwritten by the underflow error generated by trying to
read the non-existent section.

Updates #49590

Change-Id: I1c431392123a86c78c95ef1f185ebd6f17f2476a
Reviewed-on: https://go-review.googlesource.com/c/go/+/363894
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Trust: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/debug/dwarf/entry.go

index 9f5ac570803d4c4d351633155f51ddb679eb617e..25a3b5beec3096addc785a6ed2ca78848626466c 100644 (file)
@@ -641,6 +641,7 @@ func (b *buf) entry(cu *Entry, atab abbrevTable, ubase Offset, vers int) *Entry
                        } else {
                                if len(b.dwarf.lineStr) == 0 {
                                        b.error("DW_FORM_line_strp with no .debug_line_str section")
+                                       return nil
                                }
                                b1 = makeBuf(b.dwarf, b.format, "line_str", 0, b.dwarf.lineStr)
                        }