From e658344ea46d423229556ee7109d397b76b9d0d4 Mon Sep 17 00:00:00 2001 From: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:10:08 -0500 Subject: [PATCH] Check SLC identifiers without a per-character scan --- openpilot/starpilot/speed_limits/acceptance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpilot/starpilot/speed_limits/acceptance.py b/openpilot/starpilot/speed_limits/acceptance.py index 04f32b1901..5599cb436a 100644 --- a/openpilot/starpilot/speed_limits/acceptance.py +++ b/openpilot/starpilot/speed_limits/acceptance.py @@ -163,7 +163,8 @@ class Decision: # Shared input predicates for every SLC module: one definition per question. def token(value: object) -> bool: - return type(value) is str and 0 < len(value) <= 256 and bool(value.strip()) and not any(ord(c) < 32 for c in value) + # min() is the C-level equivalent of all(ord(c) >= 32): no control characters. + return type(value) is str and 0 < len(value) <= 256 and min(value) >= ' ' and bool(value.strip()) def integer(value: object, minimum: int = 0) -> TypeGuard[int]: