Closed qwwdfsad closed 4 years ago
@qwwdfsad check this small set of tests: https://github.com/Kotlin/kotlinx.serialization/blob/master/json/common/test/kotlinx/serialization/json/CornerCaseTest.kt There are some of cases you've presented and parser works normally. Or I didn't understand contents of cases correctly?
It's kinda strange, theses cases are from our internal review (from 28.06) I'll double check that with the whole JSON corpus
I can see that you have here 'fancy macOS' quotes, while parser supports only standard quotes. Maybe the problem is in them?
Fixed in the latest stable release
After running JSON parser over Go fuzzer corpus (https://github.com/dvyukov/go-fuzz-corpus/blob/master/json/corpus/), I've found the following issues:
1) Parser breaks on valid JSON such as
{a:"\\\r0\n"}
,{“foo”: “”‘“”}
,{x: “{”}
2) Parser breaks on "strange" JSON such as{“X”: “foo”, “Y”}
and{“”:“”,“”:“”,“”:“”,“”:“”}
. Even though it's legal to fail on such inputs, GSON and Jackson don't.We should 1) Run parser on the whole corpus and fix its behaviour for valid inputs 2) At least document behaviour on "invalid" inputs and compare it with GSON/Jackson/Moshi, decide whether we should be consistent with them