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

Nil dereference with negative lookahead and -switch #33

Open
cbandy opened this issue Oct 23, 2014 · 0 comments
Open

Nil dereference with negative lookahead and -switch #33

cbandy opened this issue Oct 23, 2014 · 0 comments

Comments

@cbandy
Copy link

cbandy commented Oct 23, 2014

The following grammar causes a nil pointer dereference when using the -switch option:

package main
type test Peg {}

Begin <- !('A' / 'B' / 'BC' / !.) [D]* !.
peg -switch test.peg
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x40cf40]

goroutine 16 [running]:
runtime.panic(0x5aae80, 0x6db453)
        /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
main.(*set).intersects(0xc208005020, 0x0, 0x0)
        /home/cbandy/go/src/github.com/pointlander/peg/set.go:43 +0xa0
main.func·039(0x7f16d68ed610, 0xc208044700, 0x445f00, 0xc208004fc0)
        /home/cbandy/go/src/github.com/pointlander/peg/peg.go:1118 +0xa25
main.func·039(0x7f16d68ed610, 0xc208044880, 0x0, 0x0)
        /home/cbandy/go/src/github.com/pointlander/peg/peg.go:1199 +0x1cc7
main.func·039(0x7f16d68ed610, 0xc208044b40, 0x0, 0xc208004f60)
        /home/cbandy/go/src/github.com/pointlander/peg/peg.go:1196 +0x1bb5
main.func·039(0x7f16d68ed610, 0xc208044940, 0x7f16d68e2100, 0x0)
        /home/cbandy/go/src/github.com/pointlander/peg/peg.go:1204 +0x1e38
main.func·039(0x7f16d68ed610, 0xc208044640, 0x0, 0x0)
        /home/cbandy/go/src/github.com/pointlander/peg/peg.go:1071 +0x1b3
main.(*Tree).Compile(0xc208002c60, 0xc208036230, 0xb)
        /home/cbandy/go/src/github.com/pointlander/peg/peg.go:1223 +0xb96
main.main()
        /home/cbandy/go/src/github.com/pointlander/peg/main.go:75 +0x84d
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

1 participant