From e6775e844e7d088d1ee8d2dae0875acc005ecfbb Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 10 Aug 2016 11:03:43 +0000 Subject: 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. --- term.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'term.c') 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 - * Copyright (c) 2010-2015 Ingo Schwarze + * Copyright (c) 2010-2016 Ingo Schwarze * * 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; -- cgit v1.2.3-56-ge451