mirror of
https://github.com/json-c/json-c.git
synced 2026-11-10 07:50:14 +08:00
tokener: clear pending surrogate on reset
Discard the previous document's high surrogate when resetting the tokener. Otherwise the next Unicode escape can add a replacement character or combine with a surrogate from the abandoned document. Extend the existing incremental parse tests for incomplete input and a fatal error, using independent next-document string expectations. Fixes #984. Reported-by: GeekQAQ (GitHub) Assisted-by: OpenAI Codex (AI) Reviewed-by: GPT-6 Luna (AI)
This commit is contained in:
1 parent
9e99c1cfe7
commit
7662139501
3 files changed
+16
-1
No files matched your search
@@ -214,6 +214,7 @@ void json_tokener_reset(struct json_tokener *tok)
|
||||
json_tokener_reset_level(tok, i);
|
||||
tok->depth = 0;
|
||||
tok->err = json_tokener_success;
|
||||
tok->high_surrogate = 0;
|
||||
}
|
||||
|
||||
struct json_object *json_tokener_parse(const char *str)
|
||||
|
||||
Reference in new issue
Block a user