From 1d0e42879fa687a7b6856b1a63070e44bd8ed5c4 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Mon, 19 Feb 2018 17:32:11 +0200 Subject: [PATCH] libutil: Fix infinite loop in filterANSIEscapes on '\r' E.g. nix-instantiate --eval -E 'abort "\r"' hangs. Found by afl-fuzz. --- src/libutil/util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libutil/util.cc b/src/libutil/util.cc index f7a12d21b..341dedfdf 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1216,7 +1216,7 @@ std::string filterANSIEscapes(const std::string & s, unsigned int width) else if (*i == '\r') // do nothing for now - ; + i++; else { t += *i++; w++;