From eb087e80e7f63864cd4f2a272ea69d3c0b18d135 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Thu, 19 Mar 2026 02:38:40 +0900 Subject: [PATCH] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- tinygltf_json.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tinygltf_json.h b/tinygltf_json.h index 338af82..f39bc19 100644 --- a/tinygltf_json.h +++ b/tinygltf_json.h @@ -1280,10 +1280,13 @@ static void cj_parse_string_to(cj_parse_ctx *ctx, char **out_str, *out_str = cj_unescape_string(ctx->cur, scan, out_len); if (!*out_str) { cj_ctx_error(ctx, "string unescape failed"); } ctx->cur = scan + 1; + *out_len = len; return; } - /* Control char (< 0x20) - skip */ - ++p; + /* Control char (< 0x20) - treat as parse error (invalid JSON) */ + cj_ctx_error(ctx, "invalid control character in string"); + *out_str = NULL; *out_len = 0; + return; } cj_ctx_error(ctx, "unterminated string"); *out_str = NULL; *out_len = 0;