diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2021-10-18 02:11:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-17 17:11:23 -0700 |
commit | aff444659e59a16da7e225b9f820a884a05044e6 (patch) | |
tree | 6a4d10fe8436e67b48282e4ca69fa90f5609d5c2 | |
parent | ffc28dcbdb0d3ea7f1f70d1f9627d423f950d224 (diff) | |
download | rneovim-aff444659e59a16da7e225b9f820a884a05044e6.tar.gz rneovim-aff444659e59a16da7e225b9f820a884a05044e6.tar.bz2 rneovim-aff444659e59a16da7e225b9f820a884a05044e6.zip |
fix(PVS/V1028): prevent possible overflow #16023
Full warning: "Possible overflow. Consider casting operands, not the
result."
https://pvs-studio.com/en/docs/warnings/v1028/
-rw-r--r-- | src/nvim/marktree.c | 4 | ||||
-rw-r--r-- | src/nvim/option.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index fd7012e895..39c1e36147 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -467,7 +467,7 @@ static mtnode_t *merge_node(MarkTree *b, mtnode_t *p, int i) unrelative(x->key[x->n].pos, &x->key[x->n+1+k].pos); } if (x->level) { - memmove(&x->ptr[x->n+1], y->ptr, (size_t)(y->n + 1) * sizeof(mtnode_t *)); + memmove(&x->ptr[x->n+1], y->ptr, ((size_t)y->n + 1) * sizeof(mtnode_t *)); for (int k = 0; k < y->n+1; k++) { x->ptr[x->n+k+1]->parent = x; } @@ -489,7 +489,7 @@ static void pivot_right(MarkTree *b, mtnode_t *p, int i) mtnode_t *x = p->ptr[i], *y = p->ptr[i+1]; memmove(&y->key[1], y->key, (size_t)y->n * sizeof(mtkey_t)); if (y->level) { - memmove(&y->ptr[1], y->ptr, (size_t)(y->n + 1) * sizeof(mtnode_t *)); + memmove(&y->ptr[1], y->ptr, ((size_t)y->n + 1) * sizeof(mtnode_t *)); } y->key[0] = p->key[i]; refkey(b, y, 0); diff --git a/src/nvim/option.c b/src/nvim/option.c index 9466e841ce..a8b86ec0a0 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3510,7 +3510,7 @@ static char_u *set_chars_option(win_T *wp, char_u **varp, bool set) xfree(wp->w_p_lcs_chars.multispace); } if (multispace_len > 0) { - wp->w_p_lcs_chars.multispace = xmalloc((size_t)(multispace_len + 1) * sizeof(int)); + wp->w_p_lcs_chars.multispace = xmalloc(((size_t)multispace_len + 1) * sizeof(int)); wp->w_p_lcs_chars.multispace[multispace_len] = NUL; } else { wp->w_p_lcs_chars.multispace = NULL; |