aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-08-10 11:03:43 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-08-10 11:03:43 +0000
commite6775e844e7d088d1ee8d2dae0875acc005ecfbb (patch)
treedb8eb064d796a2d1de050f7d2a7811ca42cf2f85 /term.c
parent6737b893e3198eb8acb1647742d46a6c58cf3c30 (diff)
downloadmandoc-e6775e844e7d088d1ee8d2dae0875acc005ecfbb.tar.gz
mandoc-e6775e844e7d088d1ee8d2dae0875acc005ecfbb.tar.zst
mandoc-e6775e844e7d088d1ee8d2dae0875acc005ecfbb.zip
Fix assertion failures caused by whitespace inside \o'' (overstrike)
sequences that jsg@ found with afl(1): * Avoid writing \t\b in term.c. * Handle trailing \b in term_ps.c.
Diffstat (limited to 'term.c')
-rw-r--r--term.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/term.c b/term.c
index 0fd8f7c0..3bf78db3 100644
--- a/term.c
+++ b/term.c
@@ -1,7 +1,7 @@
-/* $Id: term.c,v 1.257 2016/04/12 15:30:00 schwarze Exp $ */
+/* $Id: term.c,v 1.258 2016/08/10 11:03:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -504,7 +504,9 @@ term_word(struct termp *p, const char *word)
}
}
/* Trim trailing backspace/blank pair. */
- if (p->col > 2 && p->buf[p->col - 1] == ' ')
+ if (p->col > 2 &&
+ (p->buf[p->col - 1] == ' ' ||
+ p->buf[p->col - 1] == '\t'))
p->col -= 2;
continue;
default:
@@ -568,7 +570,7 @@ encode1(struct termp *p, int c)
p->fontq[p->fonti] : TERMFONT_NONE;
if (p->flags & TERMP_BACKBEFORE) {
- if (p->buf[p->col - 1] == ' ')
+ if (p->buf[p->col - 1] == ' ' || p->buf[p->col - 1] == '\t')
p->col--;
else
p->buf[p->col++] = 8;