This is an automated email from the ASF dual-hosted git repository.

lostluck pushed a commit to branch lostluck-symtab-panic
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 57c6ef65a63aaa4a79520a36b1de521793e33d19
Author: Robert Burke <[email protected]>
AuthorDate: Wed Nov 27 14:05:25 2019 -0800

    [GoSDK] Don't panic if debug symbols are striped
    
    When debug symbols are stripped, the fields listing may be empty, which 
causes the next line to panic. Check the length so we can fail gracefully and 
more clearly in this case.
---
 sdks/go/pkg/beam/core/util/symtab/symtab.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdks/go/pkg/beam/core/util/symtab/symtab.go 
b/sdks/go/pkg/beam/core/util/symtab/symtab.go
index 68abfd8..cbd539d 100644
--- a/sdks/go/pkg/beam/core/util/symtab/symtab.go
+++ b/sdks/go/pkg/beam/core/util/symtab/symtab.go
@@ -154,7 +154,7 @@ func (s *SymbolTable) Sym2Addr(symbol string) (uintptr, 
error) {
                        break
                }
 
-               if e.Tag == dwarf.TagSubprogram {
+               if e.Tag == dwarf.TagSubprogram && len(e.Field) >= 2 {
                        nf := e.Field[0]
                        if nf.Attr.String() == "Name" && nf.Val.(string) == 
symbol {
                                addr := e.Field[1].Val.(uint64)

Reply via email to