aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorDan Pascu <danpascu777@gmail.com>2024-12-20 11:43:56 +0200
committerGitHub <noreply@github.com>2024-12-20 01:43:56 -0800
commit4e130c1ee446f4389a8c76c5e81b53bff8b9193c (patch)
tree48282a7f760cbb09868cde30c505e359c475ba7d /runtime/lua/vim
parent39781be14baff508efd4f99c11786c4228ea2c8d (diff)
downloadrneovim-4e130c1ee446f4389a8c76c5e81b53bff8b9193c.tar.gz
rneovim-4e130c1ee446f4389a8c76c5e81b53bff8b9193c.tar.bz2
rneovim-4e130c1ee446f4389a8c76c5e81b53bff8b9193c.zip
fix(vim.system): invalid MAX_TIMEOUT for 32-bit systems #31638
The maximum signed value on 32-bit systems is 2 ^ 31 - 1. When using 2 ^ 31 for the default timeout, the value would overflow on such systems resulting in a negative value, which caused a stack trace when calling wait() without a timeout.
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_system.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua
index c0a0570e13..157172447a 100644
--- a/runtime/lua/vim/_system.lua
+++ b/runtime/lua/vim/_system.lua
@@ -79,7 +79,8 @@ function SystemObj:_timeout(signal)
self:kill(signal or SIG.TERM)
end
-local MAX_TIMEOUT = 2 ^ 31
+-- Use max 32-bit signed int value to avoid overflow on 32-bit systems. #31633
+local MAX_TIMEOUT = 2 ^ 31 - 1
--- @param timeout? integer
--- @return vim.SystemCompleted