mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 12:28:18 +00: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:
@@ -3431,12 +3431,10 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const long multlen = count * yanklen;
|
const double multlen = (double)count * (double)yanklen;
|
||||||
|
|
||||||
totlen = (size_t)(int)multlen;
|
totlen = (size_t)(int)(count * yanklen);
|
||||||
if (count != 0 && yanklen != 0
|
if ((double)totlen != multlen) {
|
||||||
&& (totlen != (size_t)multlen || (long)totlen / count != yanklen
|
|
||||||
|| (long)totlen / yanklen != count)) {
|
|
||||||
emsg(_(e_resulting_text_too_long));
|
emsg(_(e_resulting_text_too_long));
|
||||||
break;
|
break;
|
||||||
} else if (totlen > 0) {
|
} else if (totlen > 0) {
|
||||||
|
Reference in New Issue
Block a user