vim-patch:9.2.0219: call stack can be corrupted (#38406)

Problem:  call stack can be corrupted, because calculated remaining
          capacity for call stack string can underflow (after v9.1.1983)
Solution: Calculate capacity against maximum capacity
          (Sergey Vlasov).

closes: vim/vim#19759

8e0483c2f4

Co-authored-by: Sergey Vlasov <sergey@vlasov.me>
This commit is contained in:
zeertzjq
2026-03-21 22:51:09 +08:00
committed by GitHub
parent fbac2e5edc
commit a969e92249

View File

@@ -222,7 +222,7 @@ char *estack_sfile(estack_arg_T which)
// <slnum>. Also leave it out when the number is not set.
if (lnum != 0) {
ga.ga_len += (int)vim_snprintf_safelen((char *)ga.ga_data + ga.ga_len,
len - (size_t)ga.ga_len,
(size_t)(ga.ga_maxlen - ga.ga_len),
"[%" PRIdLINENR "]", lnum);
}
if (idx != exestack.ga_len - 1) {