You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
In the added test case, "garble -literals build" would fail: --- FAIL: TestScripts/literals (8.29s) testscript.go:397: > env GOPRIVATE=test/main > garble -literals build [stderr] # test/main Usz1FmFm.go:1: cannot call non-function string (type int), declared at Usz1FmFm.go:1 Usz1FmFm.go:1: string is not a type Usz1FmFm.go:1: cannot call non-function append (type int), declared at Usz1FmFm.go:1 That is, for input code such as: var append int println("foo") _ = append We'd end up with obfuscated code like: var append int println(func() string { // obfuscation... x = append(x, ...) // obfuscation... return string(x) }) _ = append Which would then break, as the code is shadowing the "append" builtin. To work around this, always obfuscate variable names, so we end up with: var mwu1xuNz int println(func() string { // obfuscation... x = append(x, ...) // obfuscation... return string(x) }) _ = mwu1xuNz This change shouldn't make the quality of our obfuscation stronger, as local variable names do not currently end up in Go binaries. However, this does make garble more consistent in treating identifiers, and it completely avoids any issues related to shadowing builtins. Moreover, this also paves the way for publishing obfuscated source code, such as #369. Fixes #417. |
3 years ago | |
---|---|---|
.. | ||
asm.txt | 4 years ago | |
basic.txt | 4 years ago | |
cgo.txt | 4 years ago | |
crossbuild.txt | 4 years ago | |
debugdir.txt | 4 years ago | |
embed.txt | 4 years ago | |
goprivate.txt | 4 years ago | |
goversion.txt | 4 years ago | |
help.txt | 4 years ago | |
implement.txt | 4 years ago | |
imports.txt | 4 years ago | |
init.txt | 4 years ago | |
ldflags.txt | 4 years ago | |
linkname.txt | 4 years ago | |
literals.txt | 3 years ago | |
modinfo.txt | 3 years ago | |
plugin.txt | 4 years ago | |
position.txt | 4 years ago | |
reflect.txt | 4 years ago | |
reverse.txt | 3 years ago | |
runtime-related.txt | 4 years ago | |
seed.txt | 4 years ago | |
syntax.txt | 4 years ago | |
test.txt | 4 years ago | |
tiny.txt | 4 years ago |