]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix panic in DWARF-gen handling obfuscated code
authorThan McIntosh <thanm@google.com>
Fri, 19 Feb 2021 15:09:15 +0000 (10:09 -0500)
committerThan McIntosh <thanm@google.com>
Sun, 21 Feb 2021 02:25:26 +0000 (02:25 +0000)
commite78e04ce39b9df316edda08f43f253f5e9ac509e
tree8987ce4a11f20051c05db9f5cee3e7ff33170b13
parent03d36d8198428a6970ba01f5de41c264acbff8fc
cmd/compile: fix panic in DWARF-gen handling obfuscated code

DWARF generation uses variable source positions (file/line/col) as a
way to uniquely identify locals and parameters, as part of the process
of matching up post-optimization variables with the corresponding
pre-optimization versions (since the DWARF needs to be in terms of the
original source constructs).

This strategy can run into problems when compiling obfuscated or
machine-generated code, where you can in some circumstances wind up
with two local variables that appear to have the same name, file,
line, and column. This patch changes DWARF generation to skip over
such duplicates as opposed to issuing a fatal error (if an
obfuscation tool is in use, it is unlikely that a human being will be
able to make much sense of DWARF info in any case).

Fixes #44378.

Change-Id: I198022d184701aa9ec3dce42c005d29b72d2e321
Reviewed-on: https://go-review.googlesource.com/c/go/+/294289
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/dwarfgen/dwinl.go
test/fixedbugs/issue44378.go [new file with mode: 0644]