]> git.sesse.net Git - nageru/commitdiff
Fix a one-past-the-end access on Futatabi startup.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 4 Mar 2019 08:12:31 +0000 (09:12 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 4 Mar 2019 08:12:31 +0000 (09:12 +0100)
Reported by Marcus Nilsen.

shared/metrics.cpp

index b2d0bbce5ca0671a3d810bf19c74cd7dda29f1ce..248da38a277992289e9ae703bd1442f16ce077e5 100644 (file)
@@ -99,7 +99,7 @@ void Metrics::remove(const string &name, const vector<pair<string, string>> &lab
 
        // If this is the last metric with this name, remove the type as well.
        if (!((it != metrics.begin() && prev(it)->first.name == name) ||
-             (it != metrics.end() && next(it)->first.name == name))) {
+             (it != metrics.end() && next(it) != metrics.end() && next(it)->first.name == name))) {
                types.erase(name);
        }