mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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/
This commit is contained in:
parent
ffc28dcbdb
commit
aff444659e
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user