mirror of
https://github.com/json-iterator/go.git
synced 2025-02-19 19:59:49 +02:00
Check that a struct ends with closing brace
This commit is contained in:
parent
8f27a81d90
commit
b53656d459
@ -494,13 +494,16 @@ func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator)
|
||||
if !iter.readObjectStart() {
|
||||
return
|
||||
}
|
||||
decoder.decodeOneField(ptr, iter)
|
||||
for iter.nextToken() == ',' {
|
||||
var c byte
|
||||
for c = ','; c == ','; c = iter.nextToken() {
|
||||
decoder.decodeOneField(ptr, iter)
|
||||
}
|
||||
if iter.Error != nil && iter.Error != io.EOF {
|
||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||
}
|
||||
if c != '}' {
|
||||
iter.ReportError("struct Decode", `expect }, but found `+string([]byte{c}))
|
||||
}
|
||||
}
|
||||
|
||||
func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user