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

Using a transform function to/from an interface cause a nil pointer dereference #37

Open
Stebalien opened this issue Sep 25, 2018 · 0 comments

Comments

@Stebalien
Copy link
Contributor

At least when used with CBOR tags.

Repro: master...Stebalien:repro/nil-deref

Trace:

  * /home/steb/projects/go/src/github.com/polydawn/refmt/obj/objFixtures_test.go 
  Line 1540: - runtime error: invalid memory address or nil pointer dereference 
  goroutine 6 [running]:
  panic(0x5d2260, 0x78f230)
  	/usr/lib/go/src/runtime/panic.go:513 +0x1b9
  github.com/polydawn/refmt/obj.(*unmarshalMachineWildcard).Step(0xc00033c058, 0xc0000e9c80, 0xc0000e9c80, 0xc0002ce9a0, 0x5fdc60, 0xc00047ed01, 0xc0002ce9a0)
  	/home/steb/projects/go/src/github.com/polydawn/refmt/obj/unmarshalWildcard.go:32 +0x39
  github.com/polydawn/refmt/obj.(*Unmarshaller).Step(0xc0000e9c80, 0xc0002ce9a0, 0x2, 0x2, 0x1)
  	/home/steb/projects/go/src/github.com/polydawn/refmt/obj/unmarshal.go:60 +0x4c
  github.com/polydawn/refmt/obj.TestUnmarshaller.func1.1.1.2()
  	/home/steb/projects/go/src/github.com/polydawn/refmt/obj/objFixtures_test.go:1540 +0x1d1
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:97 +0x3f2
  github.com/jtolds/gls.EnsureGoroutineId(0xc000487500)
  	/home/steb/projects/go/src/github.com/jtolds/gls/gid.go:19 +0x103
  github.com/jtolds/gls.(*ContextManager).SetValues(0xc00004a550, 0xc0004874a0, 0xc0002c2e20)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:63 +0x147
  github.com/polydawn/refmt/obj.TestUnmarshaller.func1.1.1()
  	/home/steb/projects/go/src/github.com/polydawn/refmt/obj/objFixtures_test.go:1532 +0x2b3
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:97 +0x3f2
  github.com/jtolds/gls.EnsureGoroutineId(0xc0004873e0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/gid.go:19 +0x103
  github.com/jtolds/gls.(*ContextManager).SetValues(0xc00004a550, 0xc000487380, 0xc0002c2de0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:63 +0x147
  github.com/polydawn/refmt/obj.TestUnmarshaller.func1.1()
  	/home/steb/projects/go/src/github.com/polydawn/refmt/obj/objFixtures_test.go:1520 +0x3bd
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:97 +0x3f2
  github.com/jtolds/gls.EnsureGoroutineId(0xc0004872c0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/gid.go:19 +0x103
  github.com/jtolds/gls.(*ContextManager).SetValues(0xc00004a550, 0xc000487260, 0xc0002c2d60)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:63 +0x147
  github.com/polydawn/refmt/obj.TestUnmarshaller.func1()
  	/home/steb/projects/go/src/github.com/polydawn/refmt/obj/objFixtures_test.go:1511 +0x20d
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:97 +0x3f2
  github.com/jtolds/gls.EnsureGoroutineId.func1()
  	/home/steb/projects/go/src/github.com/jtolds/gls/gid.go:24 +0x2e
  github.com/jtolds/gls._m(0x0, 0xc0003b85c0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/stack_tags.go:74 +0x31
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x0, 0xc0003b85c0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/stack_tags.go:54 +0x35
  github.com/jtolds/gls.addStackTag(0x0, 0xc0003b85c0)
  	/home/steb/projects/go/src/github.com/jtolds/gls/stack_tags.go:49 +0x3a
  github.com/jtolds/gls.EnsureGoroutineId(0xc00039f410)
  	/home/steb/projects/go/src/github.com/jtolds/gls/gid.go:24 +0xc3
  github.com/jtolds/gls.(*ContextManager).SetValues(0xc00004a550, 0xc00039f3b0, 0xc0003b8580)
  	/home/steb/projects/go/src/github.com/jtolds/gls/context.go:63 +0x147
  github.com/polydawn/refmt/obj.TestUnmarshaller(0xc0000c6200)
  	/home/steb/projects/go/src/github.com/polydawn/refmt/obj/objFixtures_test.go:1509 +0x99
  testing.tRunner(0xc0000c6200, 0x616c50)
  	/usr/lib/go/src/testing/testing.go:827 +0xbf
  created by testing.(*T).Run
  	/usr/lib/go/src/testing/testing.go:878 +0x353
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