mirror of https://github.com/goccy/go-json.git
Fix decoding of escape char at UnmarshalJSON
This commit is contained in:
parent
73dac85d26
commit
6e154ee727
|
@ -218,6 +218,7 @@ func (d *interfaceDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (i
|
|||
switch buf[cursor] {
|
||||
case '\\':
|
||||
cursor++
|
||||
continue
|
||||
case '"':
|
||||
literal := buf[start:cursor]
|
||||
cursor++
|
||||
|
|
|
@ -226,6 +226,14 @@ func Test_Decoder(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestIssue98(t *testing.T) {
|
||||
data := "[\"\\"
|
||||
var v interface{}
|
||||
if err := json.Unmarshal([]byte(data), &v); err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Decoder_UseNumber(t *testing.T) {
|
||||
dec := json.NewDecoder(strings.NewReader(`{"a": 3.14}`))
|
||||
dec.UseNumber()
|
||||
|
|
Loading…
Reference in New Issue