diff --git a/feature_iter_string.go b/feature_iter_string.go index e681226..e292a52 100644 --- a/feature_iter_string.go +++ b/feature_iter_string.go @@ -92,6 +92,7 @@ func (iter *Iterator) readStringSlowPath() (ret string) { str = append(str, c) } } + iter.reportError("ReadString", "unexpected end of input") return } diff --git a/jsoniter_string_test.go b/jsoniter_string_test.go index 723fb66..5b574b3 100644 --- a/jsoniter_string_test.go +++ b/jsoniter_string_test.go @@ -105,6 +105,13 @@ func Test_write_val_string(t *testing.T) { should.Equal(`"hello"`, buf.String()) } +func Test_decode_slash(t *testing.T) { + should := require.New(t) + var obj interface{} + should.NotNil(json.Unmarshal([]byte(`"\"`), &obj)) + should.NotNil(UnmarshalFromString(`"\"`, &obj)) +} + func Benchmark_jsoniter_unicode(b *testing.B) { for n := 0; n < b.N; n++ { iter := ParseString(`"\ud83d\udc4a"`)