diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-11 19:34:16 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-11 19:34:16 +0000 |
commit | 3cf21b305104e91a28e4ce3a473672b2e88a9469 (patch) | |
tree | d5b68e4647d4250efd549cc76f530bc824c7c882 /src/ex_docmd.c | |
parent | 2284f6cca384e0ccc352bfec7277dc26386cac3d (diff) |
patch 8.2.4065: computation overflow with large cound for :yankv8.2.4065
Problem: Computation overflow with large cound for :yank.
Solution: Avoid an overflow.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 71343590d0..f16f6009fd 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2374,7 +2374,10 @@ do_one_cmd( else { ea.line1 = ea.line2; - ea.line2 += n - 1; + if (ea.line2 >= LONG_MAX - (n - 1)) + ea.line2 = LONG_MAX; // avoid overflow + else + ea.line2 += n - 1; ++ea.addr_count; /* * Be vi compatible: no error message for out of range. |