From c18abedfe29eb51fec14797ecf0bb101d22900b2 Mon Sep 17 00:00:00 2001 From: David Chen Date: Wed, 22 Nov 2017 16:47:59 -0800 Subject: Fixes out of range bug in SimpleConditionTracker. One of the unit tests was flaky because mStopAllLogMatcherIndex may be greater than the size of eventMatcherValues, so we access an element that is greater than the vector size. Test: Check unit-tests still work. Flake is a bit hard to find. Change-Id: Ib177cd0ae00bbe7aa6982c6ec31d9094253a9c10 --- cmds/statsd/src/condition/SimpleConditionTracker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds/statsd/src/condition/SimpleConditionTracker.cpp b/cmds/statsd/src/condition/SimpleConditionTracker.cpp index 60060fe60fbd..7e1c679f957d 100644 --- a/cmds/statsd/src/condition/SimpleConditionTracker.cpp +++ b/cmds/statsd/src/condition/SimpleConditionTracker.cpp @@ -210,7 +210,7 @@ void SimpleConditionTracker::evaluateCondition(const LogEvent& event, return; } - if (mStopAllLogMatcherIndex >= 0 && + if (mStopAllLogMatcherIndex >= 0 && mStopAllLogMatcherIndex < int(eventMatcherValues.size()) && eventMatcherValues[mStopAllLogMatcherIndex] == MatchingState::kMatched) { handleStopAll(conditionCache, conditionChangedCache); return; -- cgit v1.2.3-59-g8ed1b