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>2017-01-06 13:00:25 +0000
commitc195f975e4a1998a52edfd13f965d25901bf7d1b (patch)
tree6466831fc05de35b22f1595bc5f7c90453848d3a /anchor.c
parentFix menu buffer-overflow (diff)
downloadw3m-c195f975e4a1998a52edfd13f965d25901bf7d1b.tar.gz
w3m-c195f975e4a1998a52edfd13f965d25901bf7d1b.zip
Prevent negative array index for marks in shiftAnchorPosition()
Bug-Debian: https://github.com/tats/w3m/issues/62 Origin: https://anonscm.debian.org/cgit/collab-maint/w3m.git/commit/?id=d57c13282afc6b7dca029f992331b7afa0413356
Diffstat (limited to '')
-rw-r--r--anchor.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/anchor.c b/anchor.c
index ecb211d..bed8db2 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)