From: Robert Ou Date: Tue, 14 Nov 2017 12:08:36 +0000 (-0800) Subject: Fix infinite loop in abc command under emscripten X-Git-Tag: yosys-0.8~89^2~3 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9763e4d830fa85aeb1577cab4dec9f4becc28f03;p=yosys.git Fix infinite loop in abc command under emscripten --- diff --git a/passes/techmap/abc.cc b/passes/techmap/abc.cc index 8e1484301..18868c6d7 100644 --- a/passes/techmap/abc.cc +++ b/passes/techmap/abc.cc @@ -550,11 +550,13 @@ std::string replace_tempdir(std::string text, std::string tempdir_name, bool sho } std::string selfdir_name = proc_self_dirname(); - while (1) { - size_t pos = text.find(selfdir_name); - if (pos == std::string::npos) - break; - text = text.substr(0, pos) + "/" + text.substr(pos + GetSize(selfdir_name)); + if (selfdir_name != "/") { + while (1) { + size_t pos = text.find(selfdir_name); + if (pos == std::string::npos) + break; + text = text.substr(0, pos) + "/" + text.substr(pos + GetSize(selfdir_name)); + } } return text;