libutil: Fix infinite loop in filterANSIEscapes on '\r'

E.g. nix-instantiate --eval -E 'abort "\r"' hangs.

Found by afl-fuzz.
This commit is contained in:
Tuomas Tynkkynen 2018-02-19 17:32:11 +02:00
parent 056d28a601
commit 1d0e42879f

View file

@ -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++;