Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/json: panic during json unmarshal #18403
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
referenced this issue
Dec 21, 2016
The crash is occurring in the assembler implementation for
The second slice is the key field of the JSON string, as read by
This crash frankly seems completely impossible unless there has already been some memory corruption. You say "potentially there was some data corruption here"; I would have to agree. The Go runtime can't operate normally in the presence of data corruption.
Is this problem repeatable?
It seems repeatable with the bolt db in question (which I'm still trying to get my hands on).
So, until I can get a copy of the affected db, I can't replicate.
I think this may be due to a misuse of bolt.
The byte slice you are unmarshalling, entry.Value, comes from entries, which is generated in listEntries by directly preserving references to
However, the bolt docs state:
I believe the correct fix is in listEntries. When you are creating each new entry, make new k and v byte slices of the correct length and copy in the data from bolt.
You will probably want to audit the other uses of bolt for similar bugs.
Something like this (untested, typed into github comment) should do the trick: