Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when compiling with control flow enable #853

Open
furax124 opened this issue May 16, 2024 · 2 comments
Open

Problem when compiling with control flow enable #853

furax124 opened this issue May 16, 2024 · 2 comments
Labels
needs info Requires extra information to be solved

Comments

@furax124
Copy link

furax124 commented May 16, 2024

What version of Garble and Go are you using?

$ garble version
mvdan.cc/garble v0.12.1
$ go version
go1.21.3

What environment are you running Garble on?

go env Output
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\vodan\AppData\Local\go-build
set GOENV=C:\Users\vodan\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\vodan\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\vodan\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:/Users/vodan/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.3.windows-amd64
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\vodan\go\pkg\mod\golang.org\toolchain@v0.0.1-go1.21.3.windows-amd64\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.3
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=C:\Users\vodan\Desktop\Random_Things\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\vodan\AppData\Local\Temp\go-build2121471515=/tmp/go-build -gno-record-gcc-switches

What did you do?

i run this command to build with garble: garble -literals -seed=random -tiny -debugdir=out build -ldflags "-s -w -H=windowsgui"

What did you expect to see?

compile it normally

What did you see instead?

i see these error:
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
mvdan.cc/garble/internal/ssa2ast.(*funcConverter).convertBlock(0xc0006d75b8, 0xc0006d72a0, 0xc001959970, 0xc001c1b900)
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/internal/ssa2ast/func.go:774 +0x64ed
mvdan.cc/garble/internal/ssa2ast.(*funcConverter).convertToStmts(0xc002ccd5b8, 0xc000652d00)
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/internal/ssa2ast/func.go:1117 +0x218
mvdan.cc/garble/internal/ssa2ast.(*funcConverter).convert(0x885900?, 0xc000652d00)
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/internal/ssa2ast/func.go:1188 +0x4c
mvdan.cc/garble/internal/ssa2ast.Convert(0x0?, 0xc0006d7890)
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/internal/ssa2ast/func.go:70 +0xb9
mvdan.cc/garble/internal/ctrlflow.Obfuscate(0xb41220, 0xc000704400, {0xc000072770, 0x1, 0x1?}, 0xc00015cdb0)
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/internal/ctrlflow/ctrlflow.go:254 +0x83d
main.(*transformer).transformCompile(0xc000082d20, {0xc0000ac070?, 0xc000161030?, 0xd?})
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/main.go:975 +0x346
main.mainErr({0xc0000ac050, 0x14, 0x1b})
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/main.go:458 +0x5f3
main.main1()
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/main.go:255 +0x20c
main.main()
..../go/pkg/mod/mvdan.cc/garble@v0.12.1/main.go:147 +0x13
exit status 1

@lu4p lu4p added the needs info Requires extra information to be solved label May 17, 2024
@pagran
Copy link
Member

pagran commented May 25, 2024

Seems currently unsupported ssa, can you give the minimum code to reproduce it?

@furax124
Copy link
Author

Seems currently unsupported ssa, can you give the minimum code to reproduce it?

yeah sure i send you a link

https://pub.microbin.eu/upload/sloth-hawk-sloth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Requires extra information to be solved
Development

No branches or pull requests

3 participants