#938·sonic

`ConfigStd.Unmarshal` 会默默接受无效的 JSON 字符串转义,而 `encoding/json` 会返回错误

作者: brualan创建于 2026年5月10日更新于 2026年5月10日

Describe the bug

sonic.ConfigStd.Unmarshal accepts JSON strings containing invalid escape sequences (e.g. \0, \\\\x, \v, \1) without returning an error. encoding/json correctly rejects the same input with, for \0:

invalid character '0' in string escape code

This is a strict violation of RFC 8259 §7. The ABNF grammar defines the only valid characters after an escape (\, %x5C) as:

内容来源: bytedance/sonic