mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.3575: overflow check still fails when sizeof(int) == sizeof(long)
Problem: Overflow check still fails when sizeof(int) == sizeof(long).
Solution: Use a float to check the result.
e551ccfb93
This approach is... interesting...
Tests fail.
This commit is contained in:
parent
de8e2c61c1
commit
6890f8774b
@ -3431,12 +3431,10 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
||||
}
|
||||
|
||||
do {
|
||||
const long multlen = count * yanklen;
|
||||
const double multlen = (double)count * (double)yanklen;
|
||||
|
||||
totlen = (size_t)(int)multlen;
|
||||
if (count != 0 && yanklen != 0
|
||||
&& (totlen != (size_t)multlen || (long)totlen / count != yanklen
|
||||
|| (long)totlen / yanklen != count)) {
|
||||
totlen = (size_t)(int)(count * yanklen);
|
||||
if ((double)totlen != multlen) {
|
||||
emsg(_(e_resulting_text_too_long));
|
||||
break;
|
||||
} else if (totlen > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user