about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2018-02-19T15·32+0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2018-02-19T21·20+0200
commit1d0e42879fa687a7b6856b1a63070e44bd8ed5c4 (patch)
tree67542d6ec5fec4debabc88c1cb5373c615201c59 /src/libutil/util.cc
parent056d28a60110975332d8cb0c08990a1d3d8060a7 (diff)
libutil: Fix infinite loop in filterANSIEscapes on '\r'
E.g. nix-instantiate --eval -E 'abort "\r"' hangs.

Found by afl-fuzz.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index f7a12d21b244..341dedfdf038 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++;