diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-11-04 10:31:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 10:31:09 +0000 |
commit | f1c864cfe340dbb225caaf3dcbe28ee705be9f75 (patch) | |
tree | 15d3bcac280cbaaa6f5402c101680b2af5edc397 /src/nvim/linematch.c | |
parent | 24fa5f70edd4cc3b613237283ee7d63af1948c16 (diff) | |
download | rneovim-f1c864cfe340dbb225caaf3dcbe28ee705be9f75.tar.gz rneovim-f1c864cfe340dbb225caaf3dcbe28ee705be9f75.tar.bz2 rneovim-f1c864cfe340dbb225caaf3dcbe28ee705be9f75.zip |
fix(diff): remove size_t underflow (#20929)
Diffstat (limited to 'src/nvim/linematch.c')
-rw-r--r-- | src/nvim/linematch.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nvim/linematch.c b/src/nvim/linematch.c index ef63bd2321..04209bb836 100644 --- a/src/nvim/linematch.c +++ b/src/nvim/linematch.c @@ -149,10 +149,9 @@ static int count_n_matched_chars(const char **sp, const size_t n, bool iwhite) return matched_chars; } -void fastforward_buf_to_lnum(const char **s, size_t lnum) +void fastforward_buf_to_lnum(const char **s, long lnum) { - assert(lnum > 0); - for (size_t j = 0; j < lnum - 1; j++) { + for (long i = 0; i < lnum - 1; i++) { *s = strchr(*s, '\n'); (*s)++; } @@ -185,7 +184,7 @@ static void try_possible_paths(const int *df_iters, const size_t *paths, const i if ((*choice) & (1 << k)) { from_vals[k]--; const char *p = diff_blk[k]; - fastforward_buf_to_lnum(&p, (size_t)df_iters[k]); + fastforward_buf_to_lnum(&p, df_iters[k]); current_lines[k] = p; } else { current_lines[k] = NULL; |