Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
json: Fix panic when parsing malformed JSON
When scanning JSON, upon encountering an invalid token, we immediately return. Previously this return happened without inserting an EOF token. Since other functions assume that a token sequence always ends in EOF, this could cause a panic. This commit adds a synthetic EOF token after the invalid token before returning. While this does not match the real end-of-file of the source JSON, it is marking the end of the scanned bytes, so it seems reasonable. Fixes hashicorp#339
- Loading branch information