From 61799c1d01e79b7d203cf2c89798aa567a341aba Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 22 Jul 2023 18:45:44 +0200 Subject: [PATCH] Fix an off-by-one in shader bundle generation. Non-ASCII characters would inadvertently become two bytes instead of one, which would (for shaders after that in the bundle) give the wrong offsets and thus potentially corrupted shaders. Normally, this wouldn't really be noticed since the first things are comments and the lasts are #undef, but in some cases, the shader compilers would complain on suspicious things. Reported by Stefano Rivera, who also provided a test system for debugging. --- make_bundled_shaders.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make_bundled_shaders.cpp b/make_bundled_shaders.cpp index 53ce13f..225d084 100644 --- a/make_bundled_shaders.cpp +++ b/make_bundled_shaders.cpp @@ -54,7 +54,7 @@ int main(int argc, char **argv) } else if (ch == '\\') { printf("\\\\"); } else if (!isprint(ch)) { - printf("\\0%o", ch); + printf("\\%o", ch); } else { printf("%c", ch); } -- 2.39.2