jsonparser icon indicating copy to clipboard operation
jsonparser copied to clipboard

panic: runtime error: index out of range

Open bshafiee opened this issue 6 years ago • 0 comments

Our production machines hit this error after running for a long time (couple of months). Unfortunately we do not have the payload to recreate but I've the stacktrace (I'll add more information if I find out more):

  	 log:	 	/go/src/.../vendor/github.com/buger/jsonparser/parser.go:816 +0x73
github.com/.../vendor/github.com/buger/jsonparser.Get(0xc43e44e000, 0x6dc, 0x6dc, 0xc43d77e5e0, 0x1, 0x1, 0xc43d77e5d0, 0x1, 0x1, 0xc43e44e000, ...)

  	 log:	 	/go/src/.../vendor/github.com/buger/jsonparser/parser.go:822 +0x26a
github.com/.../vendor/github.com/buger/jsonparser.internalGet(0xc43e44e000, 0x6dc, 0x6dc, 0xc43d77e5e0, 0x1, 0x1, 0xc43cd9b1a0, 0xb, 0x6dc, 0x6dc, ...)

...
  	 log:	 	/go/src/.../vendor/github.com/buger/jsonparser/parser.go:259 +0x930
  	 github.com/.../vendor/github.com/buger/jsonparser.searchKeys(0xc43e44e000, 0x6dc, 0x6dc, 0xc43d77e5e0, 0x1, 0x1, 0x6bf)


  	 log:	 panic: runtime error: index out of range

It seems like the following line in the searchKeys function causes the panic: if equalStr(&keyUnesc, keys[level-1]) {

since we point to the master branch in our dep manager I am not sure which exact version it was using either :(

bshafiee avatar Aug 23 '18 17:08 bshafiee