diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2020-10-20 15:32:16 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2020-10-30 20:39:15 +0100 |
| commit | 87dacc4092305b0bc81165712aa0027c4b0063d1 (patch) | |
| tree | ef35e31fa585f97b127b0f409fd793828f6d90f3 | |
| parent | 3fe8d2ecb9fafc67b2731419a47a1b467f381dae (diff) | |
| download | vis-87dacc4092305b0bc81165712aa0027c4b0063d1.tar.gz vis-87dacc4092305b0bc81165712aa0027c4b0063d1.tar.xz | |
text: avoid invalid pointer arithmetic
| -rw-r--r-- | text.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -803,8 +803,8 @@ static bool iterator_init(Iterator *it, size_t pos, Piece *p, size_t off) { .pos = pos, .piece = p, .start = p ? p->data : NULL, - .end = p ? p->data + p->len : NULL, - .text = p ? p->data + off : NULL, + .end = p && p->data ? p->data + p->len : NULL, + .text = p && p->data ? p->data + off : NULL, }; *it = iter; return text_iterator_valid(it); |
