From ba15fe5a9c8e3a3851506453220bacfec09c8ff5 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 8 Jan 2017 18:16:58 +0000 Subject: Fix an assertion failure caused by \z\[u00FF] with -Tps/-Tpdf. Reported by jsg@ after an afl(1) run long ago. --- term.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'term.c') diff --git a/term.c b/term.c index 3bf78db3..1217d473 100644 --- a/term.c +++ b/term.c @@ -1,7 +1,7 @@ -/* $Id: term.c,v 1.258 2016/08/10 11:03:43 schwarze Exp $ */ +/* $Id: term.c,v 1.259 2017/01/08 18:16:58 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010-2016 Ingo Schwarze + * Copyright (c) 2010-2017 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 @@ -606,8 +606,20 @@ encode(struct termp *p, const char *word, size_t sz) if (ASCII_HYPH == word[i] || isgraph((unsigned char)word[i])) encode1(p, word[i]); - else + else { p->buf[p->col++] = word[i]; + + /* + * Postpone the effect of \z while handling + * an overstrike sequence from ascii_uc2str(). + */ + + if (word[i] == '\b' && + (p->flags & TERMP_BACKBEFORE)) { + p->flags &= ~TERMP_BACKBEFORE; + p->flags |= TERMP_BACKAFTER; + } + } } } -- cgit v1.2.3