From 8b3a6dbcf7cdf7c1abcea7cdab773511d66afc69 Mon Sep 17 00:00:00 2001 From: baidu_38995579 Date: Sat, 6 Sep 2025 17:25:16 +0800 Subject: [PATCH] Handling alarms 0702 Issue:https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICWPJG?from=project-issue Signed-off-by: baidu_38995579 --- .../ets/sdk/native/api/ani_textencoder_helper.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/static_core/plugins/ets/sdk/native/api/ani_textencoder_helper.cpp b/static_core/plugins/ets/sdk/native/api/ani_textencoder_helper.cpp index 6b79928bc5..87cd5a6f89 100644 --- a/static_core/plugins/ets/sdk/native/api/ani_textencoder_helper.cpp +++ b/static_core/plugins/ets/sdk/native/api/ani_textencoder_helper.cpp @@ -96,11 +96,13 @@ bool Utf8ToUtf16LEByteCheck(const unsigned char *data, std::u16string &u16Str, s break; } case THREE_BYTES_STYLE: { - uint8_t c2 = data[i + 1]; - uint8_t c3 = data[i + 2]; if (i + TWO_MORE_BYTES_TO_CONSUME >= inputSizeBytes) { return false; } + // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) + uint8_t c2 = data[i + 1]; + uint8_t c3 = data[i + 2]; + // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic) i += TWO_MORE_BYTES_TO_CONSUME + 1; // CC-OFFNXT(G.FMT.02-CPP) project code style // NOLINTBEGIN(hicpp-signed-bitwise) @@ -112,10 +114,11 @@ bool Utf8ToUtf16LEByteCheck(const unsigned char *data, std::u16string &u16Str, s } case TWO_BYTES_STYLE1: case TWO_BYTES_STYLE2: { - uint8_t c2 = data[i + 1]; if (i + ONE_MORE_BYTE_TO_CONSUME >= inputSizeBytes) { return false; } + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + uint8_t c2 = data[i + 1]; i += ONE_MORE_BYTE_TO_CONSUME + 1; // NOLINTNEXTLINE(hicpp-signed-bitwise) uint32_t codePoint = ((c1 & LOWER_5_BITS_MASK) << UTF8_VALID_BITS) | (c2 & LOWER_6_BITS_MASK); -- Gitee