bootstat: crash when parsing ro.boot.boottime
If ro.boot.boottime is malformed or truncated, it will crash
bootstat operations.
Test: compile
Bug: 121161069
Bug: 124114707
Change-Id: Ie2edcffb6d54a8e0c7f2e9a89ae4b29cce246d75
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 6700b6c..8528752 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -1019,6 +1019,7 @@
auto stageTimingValues = android::base::Split(stageTiming, ":");
DCHECK_EQ(2U, stageTimingValues.size());
+ if (stageTimingValues.size() < 2) continue;
std::string stageName = stageTimingValues[0];
int32_t time_ms;
if (android::base::ParseInt(stageTimingValues[1], &time_ms)) {