about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/aflrun.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/aflrun.cpp b/src/aflrun.cpp
index 5cb1c61d..b23c9e02 100644
--- a/src/aflrun.cpp
+++ b/src/aflrun.cpp
@@ -1,6 +1,5 @@
 #include "aflrun.h"
 
-#include <boost/algorithm/string.hpp>
 #include <boost/dynamic_bitset.hpp>
 #include <boost/functional/hash.hpp>
 #include <boost/make_shared.hpp>
@@ -354,17 +353,22 @@ AFLRunConfig::loaders(
 	}},
 	{"unite_ratio", [](AFLRunConfig* config, const string& val)
 	{ // Format: "cov,ctx,pro,tgt"
-		vector<string> ratios;
-		bo::split(ratios, val, [](char c) -> bool { return c == ','; });
-		if (ratios.size() != 4)
-			throw string("Invalid 'unite_ratio'");
+		std::string::size_type begin = 0;
 		for (size_t i = 0; i < 4; ++i)
 		{
-			double r = stod(ratios[i]);
+			const auto end = val.find(',', begin);
+			if (i < 3 && end == std::string::npos)
+				throw string("Invalid 'unite_ratio'");
+			const auto count = (end == std::string::npos) ?
+				end : (end - begin);
+			begin = end;
+			const auto r = stod(val.substr(begin, count));
 			if (isnan(r) || isinf(r) || r < 0)
 				throw string("Invalid 'unite_ratio'");
 			config->unite_ratio[i] = r;
 		}
+		if (begin != std::string::npos)
+			throw string("Invalid 'unite_ratio'");
 	}},
 	{"single_supp_thr", [](AFLRunConfig* config, const string& val)
 	{ // If true, we only use LHS as support count threshold