fix(input): validate escaped text against the actual command budget

The editor could clear 2048 quote characters although escaping exceeded the Native 4096-byte command budget. Measure the complete command before sending and retain oversized text. Core, Native and Browser use the 8192-byte UTF-8 carrier bound; independent queue budgets keep their own names. Static Browser values are compared with compiled Core, with no new WASM hot-path dependency. Real WebCrypto boundary probes, Native compilation and all 2521 Web tests pass.
This commit is contained in:
AAA committed 2026-11-27 00:59:56 -05:00
1 parent ec34b77aec
commit aa4e6ee45c
14 files changed
+65 -17

No files matched your search

@@ -1,7 +1,7 @@
import { useCallback, useEffect, useId, useMemo, useRef, useState, type CSSProperties, type ReactNode, type RefObject } from "react";
import { createPortal } from "react-dom";
import type { RemoteInputEvent } from "../../remote-control/input-session";
import { REMOTE_TEXT_BYTES, type RemoteInputPlatform } from "../../remote-control/protocol";
import { remoteTextFits, type RemoteInputPlatform } from "../../remote-control/protocol";
import { RemoteKeyboardPresses } from "../../remote-control/keyboard";
import { readRoomPreferences, saveRoomPreferences, REMOTE_KEYBOARD_PAGES, type RoomPreferences } from "../../lib/room-preferences";
import { onDocumentInactive } from "../../ui/document-active";
@@ -68,7 +68,7 @@ export function RemoteKeyboard({ input, close, mouseControl, inputSurface, touch
const [combineKeys, setCombineKeys] = useState(() => readRoomPreferences().combineKeys);
const composing = useRef(false);
const editor = useRef<HTMLTextAreaElement>(null);
const textTooLong = new TextEncoder().encode(text).length > REMOTE_TEXT_BYTES;
const textTooLong = !remoteTextFits(text);
const panel = useRef<HTMLElement>(null);
const panelWindow = usePanelWindow(true, onSurfaceChange);
const owner = panelWindow.surfaceDocument ?? document;