From 4b3d6edbd7eef10e41868cf959a2761b6298be9f Mon Sep 17 00:00:00 2001 From: IonutParau Date: Fri, 27 Jun 2025 21:45:35 +0200 Subject: [PATCH] progress unicode is still horribly fucked tho, it seems as if somehow the pattern matching is fucking us over. My hypothesis is that the code that does the thing does not do the thing correctly. It is entirely possible that that code is in fact bugged, and thus does the thing incorrectly. This revelation will have drastic impacts on fishing season --- src/components/gpu.c | 9 +++++++++ src/testLuaArch.c | 1 + 2 files changed, 10 insertions(+) diff --git a/src/components/gpu.c b/src/components/gpu.c index 9f7c417..7a9cd57 100644 --- a/src/components/gpu.c +++ b/src/components/gpu.c @@ -134,6 +134,11 @@ void nni_gpu_set(nni_gpu *gpu, void *_, nn_component *component, nn_computer *co return; } + if(!nn_unicode_validate(s)) { + nn_setCError(computer, "invalid utf-8"); + return; + } + int current = 0; while(s[current]) { int codepoint = nn_unicode_codepointAt(s, current); @@ -294,6 +299,10 @@ void nni_gpu_fill(nni_gpu *gpu, void *_, nn_component *component, nn_computer *c nn_setCError(computer, "bad argument #5 (character expected)"); return; } + if(!nn_unicode_validate(s)) { + nn_setCError(computer, "invalid utf-8"); + return; + } int codepoint = nn_unicode_codepointAt(s, 0); diff --git a/src/testLuaArch.c b/src/testLuaArch.c index 103a351..dc21ebd 100644 --- a/src/testLuaArch.c +++ b/src/testLuaArch.c @@ -483,6 +483,7 @@ int testLuaArch_unicode_char(lua_State *L) { if(!lua_isinteger(L, idx)) { nn_free(codepoints); luaL_argerror(L, idx, "integer expected"); + return 0; } codepoints[i] = lua_tointeger(L, idx); }