-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
When dealing with incomplete JSON, the (*Decoder).Token
method returns io.EOF
at the end of the input instead of providing an appropriate error. For example, the following code does not produce an error:
https://go.dev/play/p/HHEwVkRCs7a
dec := json.NewDecoder(strings.NewReader(`[123,`))
for {
_, err := dec.Token()
if err == io.EOF {
break
}
if err != nil {
panic(err)
}
}
According to the documentation, Token guarantees that the delimiters [ ] { } it returns are properly nested and matched. However, in this example, [
is not properly nested and matched.
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.