aboutsummaryrefslogtreecommitdiffstats
path: root/anchor.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-12-04 15:00:18 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-12-05 12:44:17 +0000
commitd57c13282afc6b7dca029f992331b7afa0413356 (patch)
tree7948ab1cae734412bf397cb76303c050b44e504c /anchor.c
parentUpdate ChangeLog (diff)
downloadw3m-d57c13282afc6b7dca029f992331b7afa0413356.tar.gz
w3m-d57c13282afc6b7dca029f992331b7afa0413356.zip
Prevent negative array index for marks in shiftAnchorPosition()
Bug-Debian: https://github.com/tats/w3m/issues/62
Diffstat (limited to 'anchor.c')
-rw-r--r--anchor.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/anchor.c b/anchor.c
index 10d6c1c..b6d121c 100644
--- a/anchor.c
+++ b/anchor.c
@@ -551,7 +551,8 @@ shiftAnchorPosition(AnchorList *al, HmarkerList *hl, int line, int pos,
break;
if (a->start.pos > pos) {
a->start.pos += shift;
- if (hl && hl->marks && hl->marks[a->hseq].line == line)
+ if (hl && hl->marks &&
+ a->hseq >= 0 && hl->marks[a->hseq].line == line)
hl->marks[a->hseq].pos = a->start.pos;
}
if (a->end.pos >= pos)