comparison src/register.c @ 28988:e6f486df5cc9 v8.2.5016

patch 8.2.5016: access before start of text with a put command Commit: https://github.com/vim/vim/commit/2a585c85013be22f59f184d49612074fd9b115d7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 25 15:15:38 2022 +0100 patch 8.2.5016: access before start of text with a put command Problem: Access before start of text with a put command. Solution: Check the length is more than zero.
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 May 2022 16:30:02 +0200
parents 6cdf55afaae9
children 45c182c4f7e9
comparison
equal deleted inserted replaced
28987:ddbc9ec9466b 28988:e6f486df5cc9
2217 // Correct the length for change in indent. 2217 // Correct the length for change in indent.
2218 curbuf->b_op_end.lnum = new_lnum; 2218 curbuf->b_op_end.lnum = new_lnum;
2219 len = STRLEN(y_array[y_size - 1]); 2219 len = STRLEN(y_array[y_size - 1]);
2220 col = (colnr_T)len - lendiff; 2220 col = (colnr_T)len - lendiff;
2221 if (col > 1) 2221 if (col > 1)
2222 curbuf->b_op_end.col = col - 1 2222 {
2223 - mb_head_off(y_array[y_size - 1], 2223 curbuf->b_op_end.col = col - 1;
2224 if (len > 0)
2225 curbuf->b_op_end.col -= mb_head_off(y_array[y_size - 1],
2224 y_array[y_size - 1] + len - 1); 2226 y_array[y_size - 1] + len - 1);
2227 }
2225 else 2228 else
2226 curbuf->b_op_end.col = 0; 2229 curbuf->b_op_end.col = 0;
2227 2230
2228 if (flags & PUT_CURSLINE) 2231 if (flags & PUT_CURSLINE)
2229 { 2232 {