From 3a6a35749a621ce87102d17655e22e4e418d42e0 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 26 Jun 2023 14:44:09 -0700 Subject: [PATCH] length limits for qrcode texture urls --- .efrocachemap | 40 +++++++++---------- CHANGELOG.md | 7 +++- src/assets/ba_data/python/baenv.py | 2 +- src/ballistica/base/assets/texture_asset.cc | 17 ++++++++ src/ballistica/shared/ballistica.cc | 2 +- .../shared/foundation/event_loop.cc | 8 +--- .../python/methods/python_methods_ui_v1.cc | 6 ++- 7 files changed, 50 insertions(+), 32 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 7cebddc4..eb9f5425 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4068,26 +4068,26 @@ "build/assets/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/2d/ef/5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/b0/8a/55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/86/5b/2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/7a/5c/7f2aaa9051adf632dc957f61ef55", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ae/11/e739a151be864da4c87c15c155fa", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/bc/0c/f1a578e5329a81a91618b03f7029", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/32/e1/c608186cfa17d5ebc93e676166bd", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/0f/b0/bfd562781cf6ae1b0224d76e7c3b", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f3/a9/1b6cce29b356c2317b6f1126ba9b", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/67/ac/03c3e7d5499a978e2af2099aae55", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/22/c0/4b32851978bf97cccd4c45f71a43", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/90/28/e0d6e0de8df08e0537816c8838a0", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/3d/c5/ffa0a2051e467d002bc272316da6", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9f/fe/5e9e6873b520b720754ab1794b3c", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/62/8f/4ffeb86197612d84f648141e5dd4", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b6/ca/46a742136cc8824e171de4c8e683", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/c0/d6/18ad1186b589cd30d0f252b0b542", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/12/df/24c41de1b3bab9d010b17969c69f", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/75/c2/8f3635450156521401ff37c6070c", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/8e/df/6d1d1ef0ed45c6a81f60e7dbc3a5", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/bf/1e/d1bf7b259d98fd464889aa755c22", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/46/1b/20394315126f1f9aa200bd736ad7", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/25/36/a159b2c628f6cbbbcc7aa8f90b12", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d1/5f/aa35974d118ac4a45de5d105edd5", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/85/7b/fa206153e23235bd97eb3abfb45a", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c8/97/a251315351949cbe40914f3f02a3", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7f/07/1ba1983b2ad7b1061f0c7624ee87", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/14/3b/984737685ea813a3a8d587fd9083", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/03/ee/59971d68ce248f89175441bc232c", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/69/0a/1a067c77c85e2a57fccdd553fe44", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d8/af/beea487d4cd9b68e323af8190bdb", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/7f/aa/f77f3330bea584a9710f13485ac0", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/fa/1e/f0c6f0a6edf00bd4975c30b44957", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/eb/ca/e8aa9629a9da31c838e8d7dd0f9d", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d0/13/08ed924a1032c25b5404f505398b", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b6/10/dd86496c0e5eac41803e43c552d3", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/89/d2/087efa3672aa053f6456cf5d263f", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/aa/a5/7a4703567c6f754e2248c115fb09", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/71/c1/e52972ac5b26273ad841da7d664b", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/b3/2f/1af856ae52297f7952329efc7617", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/84/5c/b58affdbdae8e334f7dcff14c684", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/4b/e7/5964489b7d22e27a413c9edb9eb3", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/1e/c9/770a9e209a63de714aff7da7e8ee", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/be/19/b5458933dfc7371d91ecfcd2e06f", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4e/48/123b806cbe6ddb3d9a8368bbb4f8", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/be/19/b5458933dfc7371d91ecfcd2e06f", diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb4b892..1bb7bdcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ -### 1.7.21 (build 21147, api 8, 2023-06-26) +### 1.7.21 (build 21148, api 8, 2023-06-26) - Fixed an issue where server builds would not always include collision meshes. - Upgraded Python to 3.11.4 on Android builds. - Cleaned up the language subsystem and the process for applying app-config changes a bit. Please holler if you see weirdness in either. +- QR code textures now have a soft limit of 64 bytes for their addresses. + Warnings will be given for longer addresses up to 96 bytes at which point qr + code creation will fail. This should keep the images reasonably readable and + avoids a crash that could occur when more data was provided than could + physically fit in the qr code. ### 1.7.20 (build 21140, api 8, 2023-06-22) diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index dfa06e89..3c48c583 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21147 +TARGET_BALLISTICA_BUILD = 21148 TARGET_BALLISTICA_VERSION = '1.7.21' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/base/assets/texture_asset.cc b/src/ballistica/base/assets/texture_asset.cc index 8122e958..0edbdad3 100644 --- a/src/ballistica/base/assets/texture_asset.cc +++ b/src/ballistica/base/assets/texture_asset.cc @@ -59,6 +59,23 @@ TextureAsset::TextureAsset(TextPacker* packer) : packer_(packer) { } TextureAsset::TextureAsset(const std::string& qr_url) : is_qr_code_(true) { + int hard_limit{96}; + int soft_limit{64}; + if (qr_url.size() > hard_limit) { + char buffer[512]; + snprintf(buffer, sizeof(buffer), + "QR code url byte length %zu exceeds hard-limit of %d;" + " please use shorter urls. (url=%s)", + qr_url.size(), hard_limit, qr_url.c_str()); + throw Exception(buffer, PyExcType::kValue); + } else if (qr_url.size() > soft_limit) { + char buffer[512]; + snprintf(buffer, sizeof(buffer), + "QR code url byte length %zu exceeds soft-limit of %d;" + " please use shorter urls. (url=%s)", + qr_url.size(), soft_limit, qr_url.c_str()); + Log(LogLevel::kWarning, buffer); + } file_name_ = qr_url; valid_ = true; } diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index c753211e..31089a65 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21147; +const int kEngineBuildNumber = 21148; const char* kEngineVersion = "1.7.21"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { diff --git a/src/ballistica/shared/foundation/event_loop.cc b/src/ballistica/shared/foundation/event_loop.cc index 96f1d04c..8603b0ca 100644 --- a/src/ballistica/shared/foundation/event_loop.cc +++ b/src/ballistica/shared/foundation/event_loop.cc @@ -130,6 +130,7 @@ auto EventLoop::ThreadMainLogicP(void* data) -> void* { auto EventLoop::ThreadMainAudio(void* data) -> int { return static_cast(data)->ThreadMain(); } + auto EventLoop::ThreadMainAudioP(void* data) -> void* { static_cast(data)->ThreadMain(); return nullptr; @@ -439,9 +440,6 @@ void EventLoop::Quit() { EventLoop::~EventLoop() = default; -#pragma clang diagnostic push -#pragma ide diagnostic ignored "ConstantConditionsOC" - void EventLoop::LogThreadMessageTally( std::vector>* log_entries) { assert(g_core); @@ -494,7 +492,6 @@ void EventLoop::LogThreadMessageTally( writing_tally_ = false; } } -#pragma clang diagnostic pop void EventLoop::PushThreadMessage(const ThreadMessage& t) { assert(g_core); @@ -736,9 +733,6 @@ auto EventLoop::CheckPushSafety() -> bool { } auto EventLoop::CheckPushRunnableSafety() -> bool { std::unique_lock lock(thread_message_mutex_); - - // We first complain when we get to 1000 queued messages so - // let's consider things unsafe when we're halfway there. return thread_messages_.size() < kThreadMessageSafetyThreshold; } diff --git a/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc b/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc index 083eb981..979df1e3 100644 --- a/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc +++ b/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc @@ -146,7 +146,9 @@ static PyMethodDef PyGetQRCodeTextureDef = { "get_qrcode_texture(url: str) -> bauiv1.Texture\n" "\n" - "(internal)", + "Return a QR code texture.\n" + "\n" + "The provided url must be 64 bytes or less.", }; // ----------------------------- buttonwidget ---------------------------------- @@ -2305,7 +2307,7 @@ static PyMethodDef PyUIBoundsDef = { "Returns a tuple of 4 values: (x-min, x-max, y-min, y-max) " "representing\n" "the range of values that can be plugged into a root level\n" - "babase.ContainerWidget's stack_offset value while guaranteeing that its\n" + "bauiv1.ContainerWidget's stack_offset value while guaranteeing that its\n" "center remains onscreen.", };