From 1cf272c40042baef6df8ac038181cb925c21c93b Mon Sep 17 00:00:00 2001 From: fengyang Date: Wed, 4 Jun 2025 18:59:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fengyang --- services/common/src/bundle_active_core.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index 2212de0..07cdc9a 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -35,6 +35,7 @@ namespace DeviceUsageStats { const int32_t DEFAULT_OS_ACCOUNT_ID = 0; // 0 is the default id when there is no os_account part #endif // OS_ACCOUNT_PART_ENABLED constexpr int32_t BUNDLE_UNINSTALL_DELAY_TIME = 5 * 1000 * 1000; +constexpr int32_t MIN_USER_ID = -1; static constexpr char RSS[] = "RSS"; BundleActiveReportHandlerObject::BundleActiveReportHandlerObject() @@ -530,6 +531,9 @@ void BundleActiveCore::OnUserRemoved(const int32_t userId) { BUNDLE_ACTIVE_LOGD("OnUserRemoved called"); std::lock_guard lock(mutex_); + if (MIN_USER_ID > userId || userId > INT32_MAX) { + return; + } auto it = userStatServices_.find(userId); if (it == userStatServices_.end()) { return; -- Gitee