Repository navigation
api_dump: Escape strings in JSON output - #3
Merged
Merged
Conversation
dump_char wrote string values into the JSON dump as-is, wrapped in quotes. A string containing a line break, quote, backslash or other control character made the .apidump file invalid JSON, and readers stopped parsing at that point, losing every frame after it. Vulkan Samples "subpasses" triggers this: it names a render pass "RP with 2 subpasses:" followed by line breaks. Add dump_json_string_w, which escapes '"', '\\' and all control characters as JSON requires (\n, \r, \t, \b, \f, and \u00XX for the rest), and use it in dump_char's JSON path. Text that needs no escaping is still written in one piece through ApiDumpFastWriter. Every string the layer dumps goes through dump_char: all 58 generated char*, char[N] and char* array fields and parameters, including object names, debug labels, instance info, layer and extension names, and device and driver properties. The generator does the same for every char type, so the fix holds when the code is regenerated. Other JSON values (function names, type names, numbers, flags) are fixed text or numbers. Text and HTML output are unchanged. [Co-Developed using AI] Claude-opus-5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dump_char wrote string values into the JSON dump as-is, wrapped in quotes. A string containing a line break, quote, backslash or other control character made the .apidump file invalid JSON, and readers stopped parsing at that point, losing every frame after it. Vulkan Samples "subpasses" triggers this: it names a render pass "RP with 2 subpasses:" followed by line breaks.
Add dump_json_string_w, which escapes '"', '\' and all control characters as JSON requires (\n, \r, \t, \b, \f, and \u00XX for the rest), and use it in dump_char's JSON path. Text that needs no escaping is still written in one piece through ApiDumpFastWriter.
Every string the layer dumps goes through dump_char: all 58 generated char*, char[N] and char* array fields and parameters, including object names, debug labels, instance info, layer and extension names, and device and driver properties. The generator does the same for every char type, so the fix holds when the code is regenerated. Other JSON values (function names, type names, numbers, flags) are fixed text or numbers. Text and HTML output are unchanged.
[Co-Developed using AI] Claude-opus-5.5