cmd/cgo: crash when function received string with chinese characters #29653
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
currently 1.11 is the latest release
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have a wrapper function in C file.
void initBlink(char *dllpath, char *localstorage, char *cookiejar)
and call it in other go file.
C.initBlink( C.CString(dllPath), C.CString(TempPath), C.CString(filepath.Join(TempPath, "cookie.dat")), )
What did you expect to see?
I expect it to run normally.
What did you see instead?
if the dllPath or TempPath has chinese characters, progrom will crash with below output
`
Exception 0xc0000005 0x0 0x0 0x0
PC=0x0
signal arrived during external code execution
github.com/raintean/blink._Cfunc_initBlink(0x2113c08, 0x2113c50, 0x2113c88)
_cgo_gotypes.go:138 +0x33
github.com/raintean/blink.InitBlink.func2(0x13c16200, 0x39)
e:/gowork/src/github.com/raintean/blink/blink.go:59 +0xc1
created by github.com/raintean/blink.InitBlink
e:/gowork/src/github.com/raintean/blink/blink.go:54 +0x212
goroutine 1 [syscall, locked to thread]:
syscall.Syscall9(0x751e4340, 0x7, 0x300, 0x13c105b0, 0x13c6b360, 0x400, 0x13c6b354, 0x0, 0x13db6120, 0x0, ...)
E:/Go/src/runtime/syscall_windows.go:198 +0xcf
internal/syscall/windows/registry.regLoadMUIString(0x324, 0x13c10630, 0x400, 0x13da6940, 0xf, 0x0, 0x13db6480, 0x0, 0x0)
E:/Go/src/internal/syscall/windows/registry/zsyscall_windows.go:92 +0xa3
fatal error: unexpected signal during runtime execution
[signal 0xc0000005 code=0x0 addr=0x89 pc=0x444f7f]
runtime stack:
runtime: unexpected return pc for runtime.sigtramp called from 0x33fff96c
stack: frame={sp:0x33fff73c, fp:0x33fff740} stack=[0x0,0x33ffff28)
33fff6b: 0040957d <runtime.unlock+93> 012782b0 00000000 00445bd1 <runtime.traceback+65>
33fff6cc: 0040389f <runtime.cgocall+95> 13c6b2b8 00000000 13c24000
33fff6dc: 00000000 00446d58 <runtime.tracebackothers+328> ffffffff ffffffff
33fff6ec: 00000000 13c24000 00000001 00000000
33fff6fc: 0000000d 13c24000 00000000 13c24460
33fff70c: 13c82ac0 00439738 <runtime.lastcontinuehandler+504> 13c249a0 33fffe9c
33fff71c: 00000000 13c249a0 00000000 00000000
33fff72c: 00000000 00000000 13c24460 0044ed00 <runtime.sigtramp+128>
33fff73c: <33fff96c >33fff9bc 13c249a0 0044ed40 <runtime.lastcontinuetramp+0>
33fff74c: 33fff7fc 00000000 0044ed40 <runtime.lastcontinuetramp+0> 33fff82c
33fff75c: 13c24460 33fff73c 76bd5cf0 33fff82c
33fff76c: fe4c53c7 00000000 76bd5b50 00000000
33fff77c: 00000000 7528ca20 00000001 00000000
33fff78c: 00000000 00000006 33fff82c 00000004
33fff79: 00000000 02113cc8 00000000 00000000
33fff7ac: 00000000 02113c08 77bbb569 0000002b
33fff7bc: 00000000
runtime.throw(0xf06358, 0x2a)
E:/Go/src/runtime/panic.go:608 +0x64
runtime.sigpanic()
E:/Go/src/runtime/signal_windows.go:198 +0x14d
runtime.gentraceback(0x40389f, 0x13c6b2b8, 0x0, 0x13c24000, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0, ...)
E:/Go/src/runtime/traceback.go:249 +0x113f
runtime.traceback1(0x40389f, 0x13c6b2b8, 0x0, 0x13c24000, 0x0)
E:/Go/src/runtime/traceback.go:719 +0xef
runtime.traceback(0xffffffff, 0xffffffff, 0x0, 0x13c24000)
E:/Go/src/runtime/traceback.go:673 +0x41
runtime.tracebackothers(0x13c249a0)
E:/Go/src/runtime/traceback.go:938 +0x148
runtime.lastcontinuehandler(0x33fff96c, 0x33fff9bc, 0x13c249a0, 0x44ed40)
E:/Go/src/runtime/signal_windows.go:183 +0x1f8
runtime: unexpected return pc for runtime.sigtramp called from 0x33fff96c
stack: frame={sp:0x33fff73c, fp:0x33fff740} stack=[0x0,0x33ffff28)
33fff6b: 0040957d <runtime.unlock+93> 012782b0 00000000 00445bd1 <runtime.traceback+65>
33fff6cc: 0040389f <runtime.cgocall+95> 13c6b2b8 00000000 13c24000
33fff6dc: 00000000 00446d58 <runtime.tracebackothers+328> ffffffff ffffffff
33fff6ec: 00000000 13c24000 00000001 00000000
33fff6fc: 0000000d 13c24000 00000000 13c24460
33fff70c: 13c82ac0 00439738 <runtime.lastcontinuehandler+504> 13c249a0 33fffe9c
33fff71c: 00000000 13c249a0 00000000 00000000
33fff72c: 00000000 00000000 13c24460 0044ed00 <runtime.sigtramp+128>
33fff73c: <33fff96c >33fff9bc 13c249a0 0044ed40 <runtime.lastcontinuetramp+0>
33fff74c: 33fff7fc 00000000 0044ed40 <runtime.lastcontinuetramp+0> 33fff82c
33fff75c: 13c24460 33fff73c 76bd5cf0 33fff82c
33fff76c: fe4c53c7 00000000 76bd5b50 00000000
33fff77c: 00000000 7528ca20 00000001 00000000
33fff78c: 00000000 00000006 33fff82c 00000004
33fff79: 00000000 02113cc8 00000000 00000000
33fff7ac: 00000000 02113c08 77bbb569 0000002b
33fff7bc: 00000000
runtime.sigtramp()
E:/Go/src/runtime/sys_windows_386.s:133 +0x80
goroutine 6 [syscall, locked to thread]:
runtime.cgocall(0x7a46b0, 0x13d6ff80, 0x36)
E:/Go/src/runtime/cgocall.go:128 +0x5f fp=0x13d6ff6c sp=0x13d6ff54 pc=0x40389f
github.com/raintean/blink._Cfunc_initBlink(0x2113c08, 0x2113c50, 0x2113c88)
_cgo_gotypes.go:138 +0x33 fp=0x13d6ff80 sp=0x13d6ff6c pc=0x796d63
github.com/raintean/blink.InitBlink.func2(0x13c16200, 0x39)
e:/gowork/src/github.com/raintean/blink/blink.go:59 +0xc1 fp=0x13d6ffe8 sp=0x13d6ff80 pc=0x79a271
runtime.goexit()
E:/Go/src/runtime/asm_386.s:1324 +0x1 fp=0x13d6ffec sp=0x13d6ffe8 pc=0x44e1d1
created by github.com/raintean/blink.InitBlink
e:/gowork/src/github.com/raintean/blink/blink.go:54 +0x212
`
The text was updated successfully, but these errors were encountered: