-
Notifications
You must be signed in to change notification settings - Fork 48
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
json: exclude panics from duplicate keys #3
Comments
Adding my comment from golang/go#31309: About this, I'm not sure we should consider this OK for the parser: what happens is that the field This is valid behavior, but I find it inconsistent somewhat: I would expected both payloads to end-up with the same level of pointer being nil, not being dependent on the previous value of the field. |
Discussion of how the json parser should handle particular inputs should probably happen in a new issue in the Go repo. (Sorry you keep getting bounced around.) |
I expected it. I just wanted to keep this issue updated (or at least linked) because the project here spans so much it's a little hard to keep track of everything (I've spend half my free time yesterday bouncing around while discovering :P ). |
I didn't see a new issue get filed, so just in case, cc @mvdan, who probably has opinions about the json parser's behavior. |
I don't have an opinion unless someone opens an issue on the tracker with a specific problem or proposed change ;) The decoder could certainly be taught an option to reject duplicate keys on maps and structs, though. That's the kind of thing I had in mind to fix golang/go#14750 sometime in 1.14. |
go-fuzz finds the following crasher:
"{\"o\":0,\"o\":null}"
. This doesn't survive an Unmarshal/Marshal round trip. However, this is working as intended: The second value for keyo
overwrites the first during Unmarshal, and thus the round-trip fails. See golang/go#24415 for more discussion. We should teach the json Fuzz function that duplicate keys means a round trip failure is OK.The text was updated successfully, but these errors were encountered: