From 7424a9f4e57d1023290f0cfb5eae8888212ffa59 Mon Sep 17 00:00:00 2001 From: xingzeng Date: Thu, 11 Sep 2025 14:47:11 +0800 Subject: [PATCH 1/2] Add checker beforce access handlers in ioHandlers_ Issue:https://gitee.com/openharmony/commonlibrary_c_utils/issues/ICXIRK Reason Add checker for target->fd_ when accessing handlers by ioHandlers_[target->fd_]. Value More Rubutness function. Signed-off-by: xingzeng --- base/src/io_event_reactor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/base/src/io_event_reactor.cpp b/base/src/io_event_reactor.cpp index 00eb324..6772e56 100644 --- a/base/src/io_event_reactor.cpp +++ b/base/src/io_event_reactor.cpp @@ -164,6 +164,10 @@ ErrCode IOEventReactor::RemoveHandler(IOEventHandler* target) bool IOEventReactor::HasHandler(IOEventHandler* target) { + if (target->fd_ >= ioHandlers_.size()) { + return false; + } + for (IOEventHandler* cur = ioHandlers_[target->fd_].head.get(); cur != nullptr; cur = cur->next_) { if (cur == target) { return true; -- Gitee From f7f220450dbbf567a28c8e635ed3ed323146c987 Mon Sep 17 00:00:00 2001 From: xingzeng Date: Thu, 11 Sep 2025 17:38:13 +0800 Subject: [PATCH 2/2] Remove compile condition EMULATOR_PLATFORM https://gitee.com/openharmony/commonlibrary_c_utils/issues/ICXL1H Remove compile condition EMULATOR_PLATFORM Signed-off-by: xingzeng --- base/BUILD.gn | 3 --- 1 file changed, 3 deletions(-) diff --git a/base/BUILD.gn b/base/BUILD.gn index 3efe499..2631b81 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -37,9 +37,6 @@ config("utils_config") { if (current_os == "mac") { defines += [ "MAC_PLATFORM" ] } - if (is_emulator == true) { - defines += [ "EMULATOR_PLATFORM" ] - } if (current_os == "ohos") { defines += [ "OHOS_PLATFORM" ] } -- Gitee