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

crash of go program with no dictionary installed #1

Open
brettowe opened this issue Jun 1, 2015 · 1 comment
Open

crash of go program with no dictionary installed #1

brettowe opened this issue Jun 1, 2015 · 1 comment

Comments

@brettowe
Copy link

brettowe commented Jun 1, 2015

was getting a crash as listed below trying to use this and i traced it down to fact there was no dictionary installed
the code around where it crashed should be
speller, err = aspell.NewSpeller(map[string]string{
"lang": "en_US",
})
if err != nil {
fmt.Errorf("Error: %s", err.Error())
*fakeWords = false
}
defer speller.Delete()

so even with the error check its doing the below

*** Error in `./markov': double free or corruption (fasttop): 0x0000000002a74720 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x71bad)[0x7ff68aa0abad]
/usr/lib/libc.so.6(+0x770fe)[0x7ff68aa100fe]
/usr/lib/libc.so.6(+0x778db)[0x7ff68aa108db]
/usr/lib/libaspell.so.15(_ZN7acommon12CanHaveErrorD1Ev+0x20)[0x7ff68afa5a20]
/usr/lib/libaspell.so.15(_ZN7acommon12CanHaveErrorD0Ev+0x9)[0x7ff68afa5a49]
./markov[0x441465]
======= Memory map: ========
00400000-00846000 r-xp 00000000 00:30 293 /home/bret/testweb/cur/markov/markov
00a46000-00a64000 rw-p 00446000 00:30 293 /home/bret/testweb/cur/markov/markov
00a64000-00a80000 rw-p 00000000 00:00 0
02a62000-02a94000 rw-p 00000000 00:00 0 [heap]
c000000000-c0000c2000 rw-p 00000000 00:00 0
c204f98000-c238680000 rw-p 00000000 00:00 0
7ff688cc1000-7ff688ef7000 rw-p 00000000 00:00 0
7ff688ef7000-7ff688ef8000 ---p 00000000 00:00 0
7ff688ef8000-7ff6896f8000 rw-p 00000000 00:00 0 [stack:16709]
7ff6896f8000-7ff6896f9000 ---p 00000000 00:00 0
7ff6896f9000-7ff689ef9000 rw-p 00000000 00:00 0 [stack:16708]
7ff689ef9000-7ff689f0f000 r-xp 00000000 00:11 242431 /usr/lib/libgcc_s.so.1
7ff689f0f000-7ff68a10e000 ---p 00016000 00:11 242431 /usr/lib/libgcc_s.so.1
7ff68a10e000-7ff68a10f000 rw-p 00015000 00:11 242431 /usr/lib/libgcc_s.so.1
7ff68a10f000-7ff68a212000 r-xp 00000000 00:11 241783 /usr/lib/libm-2.21.so
7ff68a212000-7ff68a411000 ---p 00103000 00:11 241783 /usr/lib/libm-2.21.so
7ff68a411000-7ff68a412000 r--p 00102000 00:11 241783 /usr/lib/libm-2.21.so
7ff68a412000-7ff68a413000 rw-p 00103000 00:11 241783 /usr/lib/libm-2.21.so
7ff68a413000-7ff68a585000 r-xp 00000000 00:11 242438 /usr/lib/libstdc++.so.6.0.21
7ff68a585000-7ff68a785000 ---p 00172000 00:11 242438 /usr/lib/libstdc++.so.6.0.21
7ff68a785000-7ff68a78f000 r--p 00172000 00:11 242438 /usr/lib/libstdc++.so.6.0.21
7ff68a78f000-7ff68a791000 rw-p 0017c000 00:11 242438 /usr/lib/libstdc++.so.6.0.21
7ff68a791000-7ff68a795000 rw-p 00000000 00:00 0
7ff68a795000-7ff68a798000 r-xp 00000000 00:11 241766 /usr/lib/libdl-2.21.so
7ff68a798000-7ff68a997000 ---p 00003000 00:11 241766 /usr/lib/libdl-2.21.so
7ff68a997000-7ff68a998000 r--p 00002000 00:11 241766 /usr/lib/libdl-2.21.so
7ff68a998000-7ff68a999000 rw-p 00003000 00:11 241766 /usr/lib/libdl-2.21.so
7ff68a999000-7ff68ab32000 r-xp 00000000 00:11 241737 /usr/lib/libc-2.21.so
7ff68ab32000-7ff68ad31000 ---p 00199000 00:11 241737 /usr/lib/libc-2.21.so
7ff68ad31000-7ff68ad35000 r--p 00198000 00:11 241737 /usr/lib/libc-2.21.so
7ff68ad35000-7ff68ad37000 rw-p 0019c000 00:11 241737 /usr/lib/libc-2.21.so
7ff68ad37000-7ff68ad3b000 rw-p 00000000 00:00 0
7ff68ad3b000-7ff68ad53000 r-xp 00000000 00:11 241757 /usr/lib/libpthread-2.21.so
7ff68ad53000-7ff68af52000 ---p 00018000 00:11 241757 /usr/lib/libpthread-2.21.so
7ff68af52000-7ff68af53000 r--p 00017000 00:11 241757 /usr/lib/libpthread-2.21.so
7ff68af53000-7ff68af54000 rw-p 00018000 00:11 241757 /usr/lib/libpthread-2.21.so
7ff68af54000-7ff68af58000 rw-p 00000000 00:00 0
7ff68af58000-7ff68b011000 r-xp 00000000 00:11 71956 /usr/lib/libaspell.so.15.1.5
7ff68b011000-7ff68b211000 ---p 000b9000 00:11 71956 /usr/lib/libaspell.so.15.1.5
7ff68b211000-7ff68b217000 r--p 000b9000 00:11 71956 /usr/lib/libaspell.so.15.1.5
7ff68b217000-7ff68b219000 rw-p 000bf000 00:11 71956 /usr/lib/libaspell.so.15.1.5
7ff68b219000-7ff68b220000 rw-p 00000000 00:00 0
7ff68b220000-7ff68b242000 r-xp 00000000 00:11 241779 /usr/lib/ld-2.21.so
7ff68b24c000-7ff68b417000 rw-p 00000000 00:00 0
7ff68b43e000-7ff68b441000 rw-p 00000000 00:00 0
7ff68b441000-7ff68b442000 r--p 00021000 00:11 241779 /usr/lib/ld-2.21.so
7ff68b442000-7ff68b443000 rw-p 00022000 00:11 241779 /usr/lib/ld-2.21.so
7ff68b443000-7ff68b444000 rw-p 00000000 00:00 0
7ffe579f2000-7ffe57a13000 rw-p 00000000 00:00 0 [stack]
7ffe57afc000-7ffe57afe000 r--p 00000000 00:00 0 [vvar]
7ffe57afe000-7ffe57b00000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
SIGABRT: abort
PC=0x7ff68a9cc528
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall_errno(0x4022b0, 0xc20807fbe8, 0xc200000000)
/usr/lib/go/src/runtime/cgocall.go:130 +0xf5 fp=0xc20807fbc8 sp=0xc20807fba0
github.com/trustmaster/go-aspell._Cfunc_delete_aspell_can_have_error(0x2a745e0)
/home/bret/golang/gopath/src/github.com/trustmaster/go-aspell/:130 +0x45 fp=0xc20807fbe8 sp=0xc20807fbc8
github.com/trustmaster/go-aspell.NewSpeller(0xc238078900, 0x0, 0x0, 0x0, 0x0)
/home/bret/golang/gopath/src/github.com/trustmaster/go-aspell/aspell.go:77 +0x572 fp=0xc20807fd78 sp=0xc20807fbe8
main.main()
/home/bret/testweb/cur/markov/markov.go:218 +0x882 fp=0xc20807ff98 sp=0xc20807fd78
runtime.main()
/usr/lib/go/src/runtime/proc.go:63 +0xf3 fp=0xc20807ffe0 sp=0xc20807ff98
runtime.goexit()
/usr/lib/go/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc20807ffe8 sp=0xc20807ffe0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/lib/go/src/runtime/asm_amd64.s:2232 +0x1

rax 0x0
rbx 0x55
rcx 0x7ff68a9cc528
rdx 0x6
rdi 0x4143
rsi 0x4143
rbp 0x7ffe57a108f0
rsp 0x7ffe57a10558
r8 0x7ff68aaf6140
r9 0x0
r10 0x8
r11 0x202
r12 0x55
r13 0x7ffe57a10708
r14 0x7ffe57a10708
r15 0x2
rip 0x7ff68a9cc528
rflags 0x202
cs 0x33
fs 0x0
gs 0x0

@smileart
Copy link

Can second that. When using with unknown language:

func Example() {
	opts := map[string]string{
		"lang": "xx_XX",
	}

	_, _ = NewSpeller(opts)
	defer speller.Delete()
// ...
}

It crashes with SIGABRT (seemingly on freeing unallocated probErr although its code is 0 and we shouldn't get there at all 🤔):

SIGABRT: abort
PC=0x7fff692de33a m=0 sigcode=0

goroutine 0 [idle]:
runtime: unknown pc 0x7fff692de33a
stack: frame={sp:0x7ffeefbfe518, fp:0x0} stack=[0x7ffeefb7f708,0x7ffeefbfe770)
00007ffeefbfe418:  00007fff693717da  0000000000000000 
00007ffeefbfe428:  00007ffeefbfe478  00007ffeefbfe470 
00007ffeefbfe438:  00000000043fe000  000000000ba91dc0 
00007ffeefbfe448:  00007ffeefbfeb70  00007fff69371765 
00007ffeefbfe458:  0000000000000050  00007ffeefbfe540 
00007ffeefbfe468:  00007fff6938df24  0000003000000018 
00007ffeefbfe478:  00007ffeefbfe550  00007ffeefbfe490 
00007ffeefbfe488:  0000000000000050  00007ffeefbfe500 
00007ffeefbfe498:  00007fff6938e073  00007fff69371765 
00007ffeefbfe4a8:  00000000043fe050  0000000000000000 
00007ffeefbfe4b8:  0000000000000000  00007ffeefbfe6a8 
00007ffeefbfe4c8:  00007ffeefbfe538  00000000043fd028 
00007ffeefbfe4d8:  0000000000000050  00007fff8fcb0f00 
00007ffeefbfe4e8:  00007fff8fcb0970  00007fff6921f065 
00007ffeefbfe4f8:  0000000000000000  00007ffeefbfe540 
00007ffeefbfe508:  00007fff692218ed  0000000000000000 
00007ffeefbfe518: <00007fff6939ae60  0000000000000003 
00007ffeefbfe528:  00000000043fd028  00007ffeefbfe560 
00007ffeefbfe538:  0000000000000000  00007ffeefbfe580 
00007ffeefbfe548:  00007fff69265808  00000000043fd028 
00007ffeefbfe558:  00007fff692d9399  00007ffffffff9df 
00007ffeefbfe568:  ffffffff043fd000  00000000043fd000 
00007ffeefbfe578:  0000000000000000  00007ffeefbfe5e0 
00007ffeefbfe588:  00007fff6935b50b  0000000000000000 
00007ffeefbfe598:  000000000ba91dc0  00007ffeefbfe6a0 
00007ffeefbfe5a8:  0000000000000000  00007fff6936f50d 
00007ffeefbfe5b8:  0000000004443c50  ffffffffffffffff 
00007ffeefbfe5c8:  000000000000005a  0000000000000059 
00007ffeefbfe5d8:  0000000000000200  00007ffeefbfe6c0 
00007ffeefbfe5e8:  00007fff6935e40f  0000000000000010 
00007ffeefbfe5f8:  0000000004331e00  0000000004443c10 
00007ffeefbfe608:  0000000000001400  0000000004400000 
runtime: unknown pc 0x7fff692de33a
stack: frame={sp:0x7ffeefbfe518, fp:0x0} stack=[0x7ffeefb7f708,0x7ffeefbfe770)
00007ffeefbfe418:  00007fff693717da  0000000000000000 
00007ffeefbfe428:  00007ffeefbfe478  00007ffeefbfe470 
00007ffeefbfe438:  00000000043fe000  000000000ba91dc0 
00007ffeefbfe448:  00007ffeefbfeb70  00007fff69371765 
00007ffeefbfe458:  0000000000000050  00007ffeefbfe540 
00007ffeefbfe468:  00007fff6938df24  0000003000000018 
00007ffeefbfe478:  00007ffeefbfe550  00007ffeefbfe490 
00007ffeefbfe488:  0000000000000050  00007ffeefbfe500 
00007ffeefbfe498:  00007fff6938e073  00007fff69371765 
00007ffeefbfe4a8:  00000000043fe050  0000000000000000 
00007ffeefbfe4b8:  0000000000000000  00007ffeefbfe6a8 
00007ffeefbfe4c8:  00007ffeefbfe538  00000000043fd028 
00007ffeefbfe4d8:  0000000000000050  00007fff8fcb0f00 
00007ffeefbfe4e8:  00007fff8fcb0970  00007fff6921f065 
00007ffeefbfe4f8:  0000000000000000  00007ffeefbfe540 
00007ffeefbfe508:  00007fff692218ed  0000000000000000 
00007ffeefbfe518: <00007fff6939ae60  0000000000000003 
00007ffeefbfe528:  00000000043fd028  00007ffeefbfe560 
00007ffeefbfe538:  0000000000000000  00007ffeefbfe580 
00007ffeefbfe548:  00007fff69265808  00000000043fd028 
00007ffeefbfe558:  00007fff692d9399  00007ffffffff9df 
00007ffeefbfe568:  ffffffff043fd000  00000000043fd000 
00007ffeefbfe578:  0000000000000000  00007ffeefbfe5e0 
00007ffeefbfe588:  00007fff6935b50b  0000000000000000 
00007ffeefbfe598:  000000000ba91dc0  00007ffeefbfe6a0 
00007ffeefbfe5a8:  0000000000000000  00007fff6936f50d 
00007ffeefbfe5b8:  0000000004443c50  ffffffffffffffff 
00007ffeefbfe5c8:  000000000000005a  0000000000000059 
00007ffeefbfe5d8:  0000000000000200  00007ffeefbfe6c0 
00007ffeefbfe5e8:  00007fff6935e40f  0000000000000010 
00007ffeefbfe5f8:  0000000004331e00  0000000004443c10 
00007ffeefbfe608:  0000000000001400  0000000004400000 

goroutine 1 [syscall]:
runtime.cgocall(0x4102630, 0xc0000469a8, 0x307)
	/usr/local/Cellar/go/1.14.1/libexec/src/runtime/cgocall.go:133 +0x5b fp=0xc000046978 sp=0xc000046940 pc=0x4004ccb
github.com/trustmaster/go-aspell._Cfunc_delete_aspell_can_have_error(0x4406110)
	_cgo_gotypes.go:331 +0x41 fp=0xc0000469a8 sp=0xc000046978 pc=0x4100491
github.com/trustmaster/go-aspell.NewSpeller.func11(0x4406110)
	/Users/username/go-aspell/aspell.go:77 +0x4d fp=0xc0000469d8 sp=0xc0000469a8 pc=0x410168d
github.com/trustmaster/go-aspell.NewSpeller(0xc000046b18, 0xc000046b18, 0x414872b, 0x4, 0xc000046bd0)
	/Users/username/Projects/go-aspell/aspell.go:77 +0x35c fp=0xc000046af0 sp=0xc0000469d8 pc=0x4100b8c
github.com/trustmaster/go-aspell.Example()
	/Users/username/Sync/Projects/go-aspell/aspell_test.go:179 +0xd3 fp=0xc000046c68 sp=0xc000046af0 pc=0x40ffbf3
testing.runExample(0x4148bd5, 0x7, 0x4151d90, 0x4148929, 0x5, 0x0, 0x0)
	/usr/local/Cellar/go/1.14.1/libexec/src/testing/run_example.go:62 +0x200 fp=0xc000046d58 sp=0xc000046c68 pc=0x40c1420
testing.runExamples(0xc000046ee8, 0x4244b60, 0x1, 0x1, 0x101)
	/usr/local/Cellar/go/1.14.1/libexec/src/testing/example.go:44 +0x1a8 fp=0xc000046e40 sp=0xc000046d58 pc=0x40bf848
testing.(*M).Run(0xc000138000, 0x0)
	/usr/local/Cellar/go/1.14.1/libexec/src/testing/testing.go:1201 +0x1ec fp=0xc000046f20 sp=0xc000046e40 pc=0x40c499c
main.main()
	_testmain.go:48 +0x135 fp=0xc000046f88 sp=0xc000046f20 pc=0x4102175
runtime.main()
	/usr/local/Cellar/go/1.14.1/libexec/src/runtime/proc.go:203 +0x212 fp=0xc000046fe0 sp=0xc000046f88 pc=0x4035d12
runtime.goexit()
	/usr/local/Cellar/go/1.14.1/libexec/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000046fe8 sp=0xc000046fe0 pc=0x4063361

goroutine 22 [IO wait]:
internal/poll.runtime_pollWait(0xb909058, 0x72, 0xffffffffffffffff)
	/usr/local/Cellar/go/1.14.1/libexec/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc00010e258, 0x72, 0x8001, 0x8000, 0xffffffffffffffff)
	/usr/local/Cellar/go/1.14.1/libexec/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/Cellar/go/1.14.1/libexec/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc00010e240, 0xc000090000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.14.1/libexec/src/internal/poll/fd_unix.go:169 +0x201
os.(*File).read(...)
	/usr/local/Cellar/go/1.14.1/libexec/src/os/file_unix.go:263
os.(*File).Read(0xc00010c030, 0xc000090000, 0x8000, 0x8000, 0x0, 0xc000034700, 0x4007bb7)
	/usr/local/Cellar/go/1.14.1/libexec/src/os/file.go:116 +0x71
io.copyBuffer(0x4173140, 0xc00008e000, 0x4173060, 0xc00010c030, 0xc000090000, 0x8000, 0x8000, 0xc0001240c0, 0xc0000347a8, 0x400765b)
	/usr/local/Cellar/go/1.14.1/libexec/src/io/io.go:405 +0x122
io.Copy(...)
	/usr/local/Cellar/go/1.14.1/libexec/src/io/io.go:364
testing.runExample.func1(0xc00010c030, 0xc000124300)
	/usr/local/Cellar/go/1.14.1/libexec/src/testing/run_example.go:37 +0x84
created by testing.runExample
	/usr/local/Cellar/go/1.14.1/libexec/src/testing/run_example.go:35 +0x16d

rax    0x0
rbx    0xba91dc0
rcx    0x7ffeefbfe518
rdx    0x0
rdi    0x307
rsi    0x6
rbp    0x7ffeefbfe540
rsp    0x7ffeefbfe518
r8     0x0
r9     0x0
r10    0xba91dc0
r11    0x246
r12    0x307
r13    0x50
r14    0x6
r15    0x16
rip    0x7fff692de33a
rflags 0x246
cs     0x7
fs     0x0
gs     0x0
exit status 2
FAIL	github.com/trustmaster/go-aspell	0.243s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants