From 913e81887e42e6500a1a6e799b23cef6ddd10e33 Mon Sep 17 00:00:00 2001 From: lowell Date: Thu, 22 Oct 2026 19:21:00 +0300 Subject: [PATCH] Fall back before an oversized VRAM override reaches the shell test --- tools/darling-system_profiler.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/darling-system_profiler.sh b/tools/darling-system_profiler.sh index 401f68e..7719431 100644 --- a/tools/darling-system_profiler.sh +++ b/tools/darling-system_profiler.sh @@ -54,7 +54,11 @@ displays() { # one line per GPU: vendor|device|vram MB or empty|name|bus 1002|10de) vendor=1002; device=7340; name='AMD Radeon Pro 5500M' vram=${DARLING_METAL_VRAM_MB:-4096} case "$vram" in ''|*[!0-9]*) vram=4096;; esac - [ "$vram" -eq 0 ] 2>/dev/null && vram=4096 + # Keep the numeric test overflow-safe: a long digit string must + # fall back before the shell compares it. + if [ "${#vram}" -gt 7 ] || [ "$vram" -eq 0 ] || [ "$vram" -gt 1048576 ]; then + vram=4096 + fi bus=pcie;; 8086) vendor=8086; device=3e9b; name='Intel UHD Graphics 630' vram=; bus=builtin;;