diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index 59d797949f6f72589eb26a6b529096e3c87cd2d6..dd48eceec3b4ebcb06ce4f419fb1236d213713be 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -46,6 +46,7 @@ ohos_shared_library("update_foundations") { "-fPIC", "-Os", "-Werror", + "-fstack-protector-strong", ] innerapi_tags = [ "platformsdk" ] diff --git a/frameworks/js/napi/update/BUILD.gn b/frameworks/js/napi/update/BUILD.gn index 0d7b70f12358afdb05e01e73c1982082e5d10715..12084aafb85075e8cf992015de636a8498e189eb 100644 --- a/frameworks/js/napi/update/BUILD.gn +++ b/frameworks/js/napi/update/BUILD.gn @@ -16,6 +16,11 @@ import("../../../../updateengine.gni") import("../session/update_session.gni") ohos_shared_library("$updateengine_client_library_name") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + } sources = [] if (ability_ability_runtime_enable) { sources += [ @@ -66,5 +71,6 @@ ohos_shared_library("$updateengine_client_library_name") { "-Os", "-Werror", "-DNAPI_VERSION=8", + "-fstack-protector-strong", ] } diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 30b88b67a59d79aa4491ad2256344a2430000928..ce6b9378e4c4f98158baddae7e0e1fc1fb8071cd 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -86,6 +86,7 @@ ohos_shared_library("$updateengine_inner_library_name") { "-fPIC", "-Os", "-Werror", + "-fstack-protector-strong", ] innerapi_tags = [ "platformsdk" ] diff --git a/interfaces/inner_api/modulemgr/modulemgr.gni b/interfaces/inner_api/modulemgr/modulemgr.gni index 2540b9fc0725a85cc264a70c00f39b637ca76f2a..8ba7e9f4e794686c77ee0ca670f06ef4059ac2d1 100644 --- a/interfaces/inner_api/modulemgr/modulemgr.gni +++ b/interfaces/inner_api/modulemgr/modulemgr.gni @@ -39,4 +39,5 @@ modulemgr_cflags = [ "-fPIC", "-Os", "-Werror", + "-fstack-protector-strong", ] diff --git a/services/engine/BUILD.gn b/services/engine/BUILD.gn index c88b23cfe3feb668aa9eb1b0740dd9205d2299d6..ef90d80573c1b480738044c1f4a91d28e0a30d62 100644 --- a/services/engine/BUILD.gn +++ b/services/engine/BUILD.gn @@ -33,6 +33,11 @@ ohos_prebuilt_etc("updater_sa.cfg") { } ohos_shared_library("$updateengine_library_name") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + } shlib_type = "sa" include_dirs = sa_include_dirs sources = sa_sources diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index 15f808bd0dd0c9eb1642a03851c6f767d3da9fd5..517b2ce4972b4706bd458b482ba59ab4014ed030 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -196,4 +196,5 @@ sa_cflags = [ "-fPIC", "-Os", "-Werror", + "-fstack-protector-strong", ]