diff options
Diffstat (limited to 'src/encoding/json/v2_scanner.go')
| -rw-r--r-- | src/encoding/json/v2_scanner.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/encoding/json/v2_scanner.go b/src/encoding/json/v2_scanner.go index 475bf58b20..aef045f466 100644 --- a/src/encoding/json/v2_scanner.go +++ b/src/encoding/json/v2_scanner.go @@ -30,6 +30,10 @@ func checkValid(data []byte) error { xd := export.Decoder(d) xd.Struct.Flags.Set(jsonflags.AllowDuplicateNames | jsonflags.AllowInvalidUTF8 | 1) if _, err := d.ReadValue(); err != nil { + if err == io.EOF { + offset := d.InputOffset() + int64(len(d.UnreadBuffer())) + err = &jsontext.SyntacticError{ByteOffset: offset, Err: io.ErrUnexpectedEOF} + } return transformSyntacticError(err) } if err := xd.CheckEOF(); err != nil { |
