jsonparser icon indicating copy to clipboard operation
jsonparser copied to clipboard

panic: runtime error: index out of range

Open ashishverma112 opened this issue 5 years ago • 4 comments

this issue is more similar to https://github.com/buger/jsonparser/issues/143. but here we are using master revision bf1c66bbce23153d89b23f8960071a680dbef54b pls let me know the root cause and if any pls help to fix it. thanks

github.com/buger/jsonparser.searchKeys(0xc4a3956000, 0x38b5, 0x3e00, 0xc4d3825860, 0x2, 0x2, 0x3488070093387c24) github.com/buger/jsonparser/parser.go:264 +0x9f8 github.com/buger/jsonparser.internalGet(0xc4a3956000, 0x38b5, 0x3e00, 0xc4d3825860, 0x2, 0x2, 0x0, 0x0, 0x412119, 0x0, ...) github.com/buger/jsonparser/parser.go:876 +0x26a github.com/buger/jsonparser.Get(0xc4a3956000, 0x38b5, 0x3e00, 0xc4d3825860, 0x2, 0x2, 0x0, 0xc4b1970bd0, 0xc43eb7e3c0, 0xc4b1970bd0, ...) github.com/buger/jsonparser/parser.go:870 +0x73 github.com/buger/jsonparser.GetInt(0xc4a3956000, 0x38b5, 0x3e00, 0xc4d3825860, 0x2, 0x2, 0xc4d3825880, 0x9d0d98, 0xc469ec2790) github.com/buger/jsonparser/parser.go:1140 +0x8

ashishverma112 avatar Jul 10 '20 19:07 ashishverma112

Can your provide the reproduce payload?

AllenX2018 avatar Jul 11 '20 01:07 AllenX2018

I'm seeing the same thing:

panic: runtime error: index out of range [1] with length 1

goroutine 200 [running]:
github.com/buger/jsonparser.searchKeys(0x7f8cd900bc67, 0x43a,
0x102bbb399, 0xc0003e9930, 0x1, 0x1, 0xffffffffffffffff)
	github.com/buger/[email protected]/parser.go:264 +0x94e
github.com/buger/jsonparser.internalGet(0x7f8cd900bc67, 0x43a,
0x102bbb399, 0xc0003e9930, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/buger/[email protected]/parser.go:884 +0x253
github.com/buger/jsonparser.Get(0x7f8cd900bc67, 0x43a, 0x102bbb399,
0xc0003e9930, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/buger/[email protected]/parser.go:878 +0x73

I'll try to get a payload to reproduce it.

djfritz avatar Aug 07 '20 13:08 djfritz

Actually it looks like #190 fixed this.

djfritz avatar Aug 07 '20 15:08 djfritz

To the original reporter I'll point out that bf1c66bbce23153d89b23f8960071a680dbef54b was back in 2018. Updating to the current master branch should put you in good shape.

floren avatar Aug 07 '20 20:08 floren