From a22ceaf165a808317d19fc48e1acc21534975f25 Mon Sep 17 00:00:00 2001 From: ostermine Date: Sat, 10 Oct 2026 01:26:09 +0300 Subject: [PATCH 1/8] add key names for punctuation keys Bindings can now use minus, equal, left-bracket, right-bracket, backslash, semicolon, apostrophe, comma, period and slash (GLFW key codes). --- src/window/input.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/window/input.cpp b/src/window/input.cpp index cbb05a888..57454020d 100644 --- a/src/window/input.cpp +++ b/src/window/input.cpp @@ -36,6 +36,16 @@ static std::unordered_map keycodes { {"left-super", GLFW_KEY_LEFT_SUPER}, {"right-super", GLFW_KEY_RIGHT_SUPER}, {"grave-accent", GLFW_KEY_GRAVE_ACCENT}, + {"minus", GLFW_KEY_MINUS}, + {"equal", GLFW_KEY_EQUAL}, + {"left-bracket", GLFW_KEY_LEFT_BRACKET}, + {"right-bracket", GLFW_KEY_RIGHT_BRACKET}, + {"backslash", GLFW_KEY_BACKSLASH}, + {"semicolon", GLFW_KEY_SEMICOLON}, + {"apostrophe", GLFW_KEY_APOSTROPHE}, + {"comma", GLFW_KEY_COMMA}, + {"period", GLFW_KEY_PERIOD}, + {"slash", GLFW_KEY_SLASH}, {"left", GLFW_KEY_LEFT}, {"right", GLFW_KEY_RIGHT}, {"down", GLFW_KEY_DOWN}, From e57e6a5cbee1543e43917ff5debde8d7732ce03d Mon Sep 17 00:00:00 2001 From: ostermine Date: Sun, 11 Oct 2026 21:36:34 +0300 Subject: [PATCH 2/8] fix modelviewer background is not transparent --- src/graphics/ui/elements/ModelViewer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/graphics/ui/elements/ModelViewer.cpp b/src/graphics/ui/elements/ModelViewer.cpp index 435f3340d..043475d13 100644 --- a/src/graphics/ui/elements/ModelViewer.cpp +++ b/src/graphics/ui/elements/ModelViewer.cpp @@ -120,7 +120,7 @@ void ModelViewer::draw(const DrawContext& pctx, const Assets& assets) { if (size.x <= 0 || size.y <= 0) { return; } - fbo = std::make_unique(size.x, size.y); + fbo = std::make_unique(size.x, size.y, true); } fbo->resize(size.x, size.y); { @@ -130,7 +130,14 @@ void ModelViewer::draw(const DrawContext& pctx, const Assets& assets) { ctx.setViewport({size.x, size.y}); ctx.setDepthTest(true); ctx.setCullFace(true); + // transparent background, the screen clear color is restored below + GLfloat clearColor[4]; + glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); display::clear(); + glClearColor( + clearColor[0], clearColor[1], clearColor[2], clearColor[3] + ); auto& ui3dShader = assets.require("ui3d"); ui3dShader.use(); From 50a02d251bf931019b86795c153b2d34b4ee242e Mon Sep 17 00:00:00 2001 From: ostermine Date: Sun, 11 Oct 2026 22:15:10 +0300 Subject: [PATCH 3/8] remove obvious comment --- src/graphics/ui/elements/ModelViewer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/graphics/ui/elements/ModelViewer.cpp b/src/graphics/ui/elements/ModelViewer.cpp index 043475d13..d3ea155b3 100644 --- a/src/graphics/ui/elements/ModelViewer.cpp +++ b/src/graphics/ui/elements/ModelViewer.cpp @@ -130,7 +130,6 @@ void ModelViewer::draw(const DrawContext& pctx, const Assets& assets) { ctx.setViewport({size.x, size.y}); ctx.setDepthTest(true); ctx.setCullFace(true); - // transparent background, the screen clear color is restored below GLfloat clearColor[4]; glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); From d753c7485897ac077e6a2fb17305be63241afa74 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 11 Oct 2026 22:17:47 +0300 Subject: [PATCH 4/8] update StdfsDevice::resolve, remove, removeAll --- src/io/devices/StdfsDevice.cpp | 46 +++++++++++++++++++++++++++++----- src/io/devices/StdfsDevice.hpp | 1 + 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/io/devices/StdfsDevice.cpp b/src/io/devices/StdfsDevice.cpp index fc0602b52..6f0e37e0e 100644 --- a/src/io/devices/StdfsDevice.cpp +++ b/src/io/devices/StdfsDevice.cpp @@ -20,10 +20,29 @@ StdfsDevice::StdfsDevice(fs::path root, bool createDirectory) << ": " << ec.message(); } } + absoluteRoot = fs::absolute(this->root).lexically_normal(); + if (!absoluteRoot.has_filename() && absoluteRoot.has_relative_path()) { + absoluteRoot = absoluteRoot.parent_path(); + } } fs::path StdfsDevice::resolve(std::string_view path) { - return root / fs::u8path(io::path(std::string(path)).normalized().string()); + if (path.find_first_of(std::string_view("\0\\:", 3)) != std::string_view::npos) { + throw std::runtime_error("invalid path"); + } + fs::path rel = fs::u8path(io::path(std::string(path)).normalized().string()); + if (rel.has_root_name() || rel.has_root_directory()) { + throw std::runtime_error("absolute paths are not allowed"); + } + fs::path full = (absoluteRoot / rel).lexically_normal(); + fs::path inside = full.lexically_relative(absoluteRoot); + if (inside.empty() || *inside.begin() == "..") { + throw std::runtime_error("path escapes device root"); + } + if (inside == ".") { + return absoluteRoot; + } + return full; } std::unique_ptr StdfsDevice::write(std::string_view path) { @@ -90,17 +109,32 @@ bool StdfsDevice::mkdirs(std::string_view path) { bool StdfsDevice::remove(std::string_view path) { auto resolved = resolve(path); - return fs::remove(resolved); + if (resolved == absoluteRoot) { + throw std::runtime_error("unable to remove device root"); + } + std::error_code ec; + bool removed = fs::remove(resolved, ec); + if (ec) { + logger.error() << "error removing " << resolved << ": " << ec.message(); + } + return removed; } uint64_t StdfsDevice::removeAll(std::string_view path) { auto resolved = resolve(path); - if (fs::exists(resolved)) { - logger.info() << "removeAll " << resolved; - return fs::remove_all(resolved); - } else { + if (resolved == absoluteRoot) { + throw std::runtime_error("unable to remove device root"); + } + std::error_code ec; + auto removed = fs::remove_all(resolved, ec); + if (ec) { + logger.error() << "error removing " << resolved << ": " << ec.message(); return 0; } + if (removed > 0) { + logger.info() << "removeAll " << resolved << ": " << removed; + } + return removed; } class StdfsPathsGenerator : public PathsGenerator { diff --git a/src/io/devices/StdfsDevice.hpp b/src/io/devices/StdfsDevice.hpp index 677cad25b..9259a9256 100644 --- a/src/io/devices/StdfsDevice.hpp +++ b/src/io/devices/StdfsDevice.hpp @@ -23,5 +23,6 @@ namespace io { std::unique_ptr list(std::string_view path) override; private: std::filesystem::path root; + std::filesystem::path absoluteRoot; }; } From 1a3f3e77e66b9f8289831dc96384076dd258c105 Mon Sep 17 00:00:00 2001 From: ostermine Date: Sun, 11 Oct 2026 22:46:32 +0300 Subject: [PATCH 5/8] docs: list punctuation key names --- doc/en/scripting/user-input.md | 2 ++ doc/ru/scripting/user-input.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/doc/en/scripting/user-input.md b/doc/en/scripting/user-input.md index d8a6e4e8e..654de1871 100644 --- a/doc/en/scripting/user-input.md +++ b/doc/en/scripting/user-input.md @@ -22,6 +22,8 @@ packid.binding.name="inputtype:codename" - a..z - 0..9 - f1..f25 +- grave-accent, minus, equal, left-bracket, right-bracket, backslash +- semicolon, apostrophe, comma, period, slash ## *input* library diff --git a/doc/ru/scripting/user-input.md b/doc/ru/scripting/user-input.md index ffcadd27c..413f74864 100644 --- a/doc/ru/scripting/user-input.md +++ b/doc/ru/scripting/user-input.md @@ -20,6 +20,8 @@ packid.binding.name="inputtype:codename" - a..z - 0..9 - f1..f25 +- grave-accent, minus, equal, left-bracket, right-bracket, backslash +- semicolon, apostrophe, comma, period, slash ## Библиотека input From ab129367adc2f515e9452d4928163df2715e0a04 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 12 Oct 2026 00:15:28 +0300 Subject: [PATCH 6/8] fix registry access in generator scripts --- src/logic/scripting/lua/lua_engine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/logic/scripting/lua/lua_engine.cpp b/src/logic/scripting/lua/lua_engine.cpp index 812f67665..1e73ea903 100644 --- a/src/logic/scripting/lua/lua_engine.cpp +++ b/src/logic/scripting/lua/lua_engine.cpp @@ -196,6 +196,10 @@ void lua::init_state(State* L, StateType stateType) { if (stateType == StateType::GENERATOR) { pushnil(L); setglobal(L, "ffi"); + + static const char* removed_debug[] { + "getregistry", "getupvalue", "setupvalue", "getinfo", nullptr}; + remove_lib_funcs(L, "debug", removed_debug); } } From 6f466d52f263081c72595a61bc2efdf958e4acb9 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 12 Oct 2026 00:21:24 +0300 Subject: [PATCH 7/8] fix: missing network.request protocol filter --- src/network/Curl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/network/Curl.cpp b/src/network/Curl.cpp index 0e08162fb..11afa5ae5 100644 --- a/src/network/Curl.cpp +++ b/src/network/Curl.cpp @@ -113,6 +113,14 @@ public: curl_easy_setopt(curl, CURLOPT_URL, request.url.c_str()); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, request.method.c_str()); + +#if LIBCURL_VERSION_NUM >= 0x075500 + curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,https"); + curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, "http,https"); +#else + curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); +#endif curl_slist* hs = nullptr; From f246619c6bbc2c144e36475cf7fcc16c3df21b73 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 12 Oct 2026 00:30:49 +0300 Subject: [PATCH 8/8] fix potential fatal errors --- src/coders/vec3.cpp | 3 +++ src/io/io.cpp | 3 +++ src/logic/scripting/lua/libs/libnetwork.cpp | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/coders/vec3.cpp b/src/coders/vec3.cpp index e00bdd662..119cbed92 100644 --- a/src/coders/vec3.cpp +++ b/src/coders/vec3.cpp @@ -133,6 +133,9 @@ static model::Mesh load_mesh( if (flags == FLAG_ZLIB) { throw std::runtime_error("compression is not supported yet"); } + if (attributeCount <= 0) { + throw std::runtime_error("mesh must have at least one attribute"); + } std::vector attributes; for (int i = 0; i < attributeCount; i++) { attributes.push_back(load_attribute(reader)); diff --git a/src/io/io.cpp b/src/io/io.cpp index 638108587..d550654e4 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -152,6 +152,9 @@ std::vector io::read_bytes(const path& filename) { std::string io::read_string(const path& filename) { size_t size; auto bytes = read_bytes(filename, size); + if (bytes == nullptr) { + throw std::runtime_error("could not read file " + filename.string()); + } return std::string((const char*)bytes.get(), size); } diff --git a/src/logic/scripting/lua/libs/libnetwork.cpp b/src/logic/scripting/lua/libs/libnetwork.cpp index 59d50f075..0d48e4a29 100644 --- a/src/logic/scripting/lua/libs/libnetwork.cpp +++ b/src/logic/scripting/lua/libs/libnetwork.cpp @@ -266,8 +266,10 @@ static int l_peek(lua::State* L, network::Network& network) { static int l_available(lua::State* L, network::Network& network) { u64id_t id = lua::tointeger(L, 1); - if (auto connection = network.getConnection(id, false)) { - return lua::pushinteger(L, dynamic_cast(connection)->available()); + if (auto connection = dynamic_cast( + network.getConnection(id, false) + )) { + return lua::pushinteger(L, connection->available()); } return 0;