From 136887b665180c13c6209a4ce0673637b6cd3afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Sun, 27 Sep 2026 18:04:11 +0200 Subject: [PATCH] common : make string_split throw on invalid values (#29518) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- common/common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/common.h b/common/common.h index 9194d3dcb..527f4be7d 100644 --- a/common/common.h +++ b/common/common.h @@ -809,7 +809,9 @@ static std::vector string_split(const std::string & str, char delim) { while (std::getline(str_stream, token, delim)) { T value; std::istringstream token_stream(token); - token_stream >> value; + if (!(token_stream >> value)) { + throw std::invalid_argument("invalid value: \"" + token + "\""); + } values.push_back(value); } return values;