diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-05-18 16:21:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-18 16:21:33 +0200 |
commit | e8beea204bf428df3e417a67c151b3a32768befc (patch) | |
tree | 1c3f25cc3ed6b9dca5a6c59847be9e4835bc9ca2 | |
parent | 8e22c4510eb9220f7ead6493fdcfdd7bf1f53d3b (diff) | |
download | rneovim-e8beea204bf428df3e417a67c151b3a32768befc.tar.gz rneovim-e8beea204bf428df3e417a67c151b3a32768befc.tar.bz2 rneovim-e8beea204bf428df3e417a67c151b3a32768befc.zip |
kbtree.h: assert valid range #10022
ref #10012
-rw-r--r-- | src/nvim/lib/kbtree.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/lib/kbtree.h b/src/nvim/lib/kbtree.h index ad6ff9cdb9..704aa26010 100644 --- a/src/nvim/lib/kbtree.h +++ b/src/nvim/lib/kbtree.h @@ -31,6 +31,7 @@ #include <stdlib.h> #include <string.h> #include <stdint.h> +#include <assert.h> #include "nvim/memory.h" @@ -332,6 +333,7 @@ if (itr->p == NULL) return 0; \ for (;;) { \ ++itr->p->i; \ + assert(itr->p->i <= 21); \ while (itr->p->x && itr->p->i <= itr->p->x->n) { \ itr->p[1].i = 0; \ itr->p[1].x = itr->p->x->is_internal? __KB_PTR(b, itr->p->x)[itr->p->i] : 0; \ @@ -377,6 +379,7 @@ itr->p->i = i; \ if (i >= 0 && r == 0) return 1; \ ++itr->p->i; \ + assert(itr->p->i <= 21); \ itr->p[1].x = itr->p->x->is_internal? __KB_PTR(b, itr->p->x)[i + 1] : 0; \ ++itr->p; \ } \ |