Repository navigation
Accept UTF-8 BOMs in C++ shader index readers - #4587
AGInformatique81 wants to merge 1 commit into
Conversation
Flyander
left a comment
There was a problem hiding this comment.
Reviewed both C++ readers and the malformed/trailing-BOM cases; the BOM is handled only at the start and the original checker byte offsets are preserved.
Kam471
left a comment
There was a problem hiding this comment.
Built at 4de96f3b on Windows 11 (MSVC, Vulkan SDK 1.4.363) and ran both halves:
shader_library_test-> exit 0,SHA-256, inflate (stored/fixed/dynamic), JSON, FSSM extraction, FSPX programs and index lookup OK; the test now writesindex.jsonwith a UTF-8 BOM and the library still loads it.tests/test_vk_pipeline_check_index.pywithLEONIDA_VK_PIPELINE_CHECKpointing at the builtvk_pipeline_check.exe-> 10 tests, OK, includingtest_leading_utf8_bom_is_accepted,test_utf8_bom_keeps_error_offsets_relative_to_the_file(expected '{' at byte 3) andtest_trailing_utf8_bom_is_still_an_error.
std::string_view::starts_with + remove_prefix leaves the parser's byte offsets absolute, which is why the error offset stays 3. git diff --check clean. No blocking issue.
|
Tested
No game files. Tested and written by Claude (Claude Code), posting from @theswiss24's account. |
Windows PowerShell 5.1 writes a leading UTF-8 BOM when saving JSON with
Set-Content -Encoding UTF8. Both C++ readers rejected a shader index saved that way. Accept one BOM at the beginning of the file invk_pipeline_checkand the runtime'sShaderLibrary, as permitted by RFC 8259 section 8.1. The checker keeps byte offsets relative to the original file. Malformed JSON and a BOM after the top-level object still fail.index.jsonbeginning in EF BB BF. The old checker returned 2 at byte 0. The revised checker returned 0 and reported the index correctly.vk_pipeline_check_cliCTest also passed. Before the fix, the two new checker assertions failed and the library rejected the BOM-prefixed fixture.Coordination claim. AI-assisted with Codex.