From d8f90bd1ff9fd31cd1cddd4f03a1e1ab6775c335 Mon Sep 17 00:00:00 2001 From: sanasol Date: Tue, 27 Jan 2026 02:44:13 +0100 Subject: [PATCH] Disable Discord URL patching entirely The Discord URL patch was causing buffer overflow crashes and has no practical effect on F2P functionality anyway. Co-Authored-By: Claude Opus 4.5 --- backend/utils/clientPatcher.js | 51 ++++------------------------------ 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/backend/utils/clientPatcher.js b/backend/utils/clientPatcher.js index 18f98b4..8fa9518 100644 --- a/backend/utils/clientPatcher.js +++ b/backend/utils/clientPatcher.js @@ -329,54 +329,13 @@ class ClientPatcher { } /** - * Patch Discord invite URLs from .gg/hytale to shorter URL - * IMPORTANT: New URL must be same length or shorter to avoid corrupting adjacent data + * Patch Discord invite URLs - DISABLED + * Was causing buffer overflow crashes on Steam Deck/Ubuntu LTS + * The Discord URL in the game doesn't affect F2P functionality anyway */ patchDiscordUrl(data) { - let count = 0; - const result = Buffer.from(data); - - const oldUrl = '.gg/hytale'; - // Use same-length URL to avoid buffer overflow - // Original: .gg/hytale (10 chars) - // New: .gg/gME8rUy3MB would be 14 chars - TOO LONG - // Using: .gg/sanasolf2p (13 chars) - still too long - // Using: .gg/hytalef2p (12 chars) - still too long - // Must be exactly 10 chars: .gg/XXXXXX (6 chars after .gg/) - const newUrl = '.gg/santop'; // 10 chars - same length, points to our server list - - // Try length-prefixed format first - const lpResult = this.replaceBytes( - result, - this.stringToLengthPrefixed(oldUrl), - this.stringToLengthPrefixed(newUrl) - ); - - if (lpResult.count > 0) { - return { buffer: lpResult.buffer, count: lpResult.count }; - } - - // Fallback to UTF-16LE - but ONLY if same length to avoid corruption - const oldUtf16 = this.stringToUtf16LE(oldUrl); - const newUtf16 = this.stringToUtf16LE(newUrl); - - if (newUtf16.length > oldUtf16.length) { - console.warn(` Warning: Discord URL replacement skipped - new URL longer than old`); - return { buffer: result, count: 0 }; - } - - const positions = this.findAllOccurrences(result, oldUtf16); - - for (const pos of positions) { - // Zero-fill first if new is shorter - if (newUtf16.length < oldUtf16.length) { - result.fill(0x00, pos, pos + oldUtf16.length); - } - newUtf16.copy(result, pos); - count++; - } - - return { buffer: result, count }; + // Disabled - no practical effect and was causing memory corruption + return { buffer: Buffer.from(data), count: 0 }; } /**