From 37b4a9ec66a507484132331c8dd9d34c4c9c5778 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 26 Jan 2023 16:43:06 +0100 Subject: [PATCH] Shut up a gcc warning --- src/libexpr/paths.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libexpr/paths.cc b/src/libexpr/paths.cc index 7a2826e7a..56b740830 100644 --- a/src/libexpr/paths.cc +++ b/src/libexpr/paths.cc @@ -40,6 +40,7 @@ SourcePath EvalState::decodePath(std::string_view s, PosIdx pos) try { auto slash = s.find('/'); + if (slash > 20) throw std::invalid_argument(""); size_t number = std::stoi(std::string(s.substr(0, slash)), nullptr, 16); s = slash == s.npos ? "" : s.substr(slash);