From f9f87a8d868f867d389d4fb93b6d3585a5108cf1 Mon Sep 17 00:00:00 2001 From: 189******51 Date: Mon, 21 Aug 2023 08:24:21 +0000 Subject: [PATCH 1/7] update base/src/parcel.cpp. Signed-off-by: 189******51 --- base/src/parcel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 1dfe931..3815e22 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1013,10 +1013,11 @@ const std::u16string Parcel::ReadString16() int32_t dataLength = 0; size_t oldCursor = readCursor_; - if (!Read(dataLength) || dataLength < 0) { + if (!Read(dataLength) || dataLength < 0 || dataLength >= 2147483647) { return std::u16string(); } + UTILS_LOGE("dataLength %{public}zu", dataLength); size_t readCapacity = (static_cast(dataLength) + 1) * sizeof(char16_t); if ((readCapacity > (static_cast(dataLength))) && (readCapacity <= GetReadableBytes())) { const uint8_t *str = ReadBuffer(readCapacity); -- Gitee From db34561fb307005fefccb8f8c3fc67d386d76366 Mon Sep 17 00:00:00 2001 From: 189******51 Date: Mon, 21 Aug 2023 09:17:10 +0000 Subject: [PATCH 2/7] update base/src/parcel.cpp. Signed-off-by: 189******51 --- base/src/parcel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 3815e22..60d6b79 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1014,10 +1014,11 @@ const std::u16string Parcel::ReadString16() size_t oldCursor = readCursor_; if (!Read(dataLength) || dataLength < 0 || dataLength >= 2147483647) { + UTILS_LOGE("return dataLength %{public}zu", dataLength); return std::u16string(); } - UTILS_LOGE("dataLength %{public}zu", dataLength); + UTILS_LOGE("continue dataLength %{public}zu", dataLength); size_t readCapacity = (static_cast(dataLength) + 1) * sizeof(char16_t); if ((readCapacity > (static_cast(dataLength))) && (readCapacity <= GetReadableBytes())) { const uint8_t *str = ReadBuffer(readCapacity); -- Gitee From f8ca3b3194b2a6c325263573553aa44fc146552f Mon Sep 17 00:00:00 2001 From: 189******51 Date: Mon, 21 Aug 2023 09:20:22 +0000 Subject: [PATCH 3/7] update base/src/parcel.cpp. Signed-off-by: 189******51 --- base/src/parcel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 60d6b79..2393135 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1014,11 +1014,11 @@ const std::u16string Parcel::ReadString16() size_t oldCursor = readCursor_; if (!Read(dataLength) || dataLength < 0 || dataLength >= 2147483647) { - UTILS_LOGE("return dataLength %{public}zu", dataLength); + UTILS_LOGE("return dataLength %{public}d", dataLength); return std::u16string(); } - UTILS_LOGE("continue dataLength %{public}zu", dataLength); + UTILS_LOGE("continue dataLength %{public}d", dataLength); size_t readCapacity = (static_cast(dataLength) + 1) * sizeof(char16_t); if ((readCapacity > (static_cast(dataLength))) && (readCapacity <= GetReadableBytes())) { const uint8_t *str = ReadBuffer(readCapacity); -- Gitee From c847f93024170b9d87f49e1bcdf7df042d6964ff Mon Sep 17 00:00:00 2001 From: 189******51 Date: Mon, 21 Aug 2023 09:28:26 +0000 Subject: [PATCH 4/7] update base/src/parcel.cpp. Signed-off-by: 189******51 --- base/src/parcel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 2393135..836ce7c 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1020,6 +1020,7 @@ const std::u16string Parcel::ReadString16() UTILS_LOGE("continue dataLength %{public}d", dataLength); size_t readCapacity = (static_cast(dataLength) + 1) * sizeof(char16_t); + UTILS_LOGE("done readCapacity %{public}zu", readCapacity); if ((readCapacity > (static_cast(dataLength))) && (readCapacity <= GetReadableBytes())) { const uint8_t *str = ReadBuffer(readCapacity); if (str != nullptr) { -- Gitee From e154b1123f630d8f15d2b78f801bd4581c3d74b9 Mon Sep 17 00:00:00 2001 From: 189******51 Date: Mon, 21 Aug 2023 10:03:34 +0000 Subject: [PATCH 5/7] update base/src/parcel.cpp. Signed-off-by: 189******51 --- base/src/parcel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 836ce7c..434753a 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1013,7 +1013,7 @@ const std::u16string Parcel::ReadString16() int32_t dataLength = 0; size_t oldCursor = readCursor_; - if (!Read(dataLength) || dataLength < 0 || dataLength >= 2147483647) { + if (!Read(dataLength) || dataLength < 0) { UTILS_LOGE("return dataLength %{public}d", dataLength); return std::u16string(); } -- Gitee From 18c79207a818738ccaecdbe1e2faa022dc75b4ee Mon Sep 17 00:00:00 2001 From: 189******51 Date: Mon, 21 Aug 2023 12:46:29 +0000 Subject: [PATCH 6/7] update base/src/parcel.cpp. Signed-off-by: 189******51 --- base/src/parcel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 434753a..836ce7c 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1013,7 +1013,7 @@ const std::u16string Parcel::ReadString16() int32_t dataLength = 0; size_t oldCursor = readCursor_; - if (!Read(dataLength) || dataLength < 0) { + if (!Read(dataLength) || dataLength < 0 || dataLength >= 2147483647) { UTILS_LOGE("return dataLength %{public}d", dataLength); return std::u16string(); } -- Gitee From 69479c8218da1b0041f8fb07f598cb4e5639e715 Mon Sep 17 00:00:00 2001 From: 189******51 Date: Tue, 22 Aug 2023 07:15:50 +0000 Subject: [PATCH 7/7] update base/src/parcel.cpp. Signed-off-by: 189******51 --- base/src/parcel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 836ce7c..f8f7c1f 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1014,13 +1014,13 @@ const std::u16string Parcel::ReadString16() size_t oldCursor = readCursor_; if (!Read(dataLength) || dataLength < 0 || dataLength >= 2147483647) { - UTILS_LOGE("return dataLength %{public}d", dataLength); + UTILS_LOGE("return dataLength %{public}d, %{public}p", dataLength, &dataLength); return std::u16string(); } - UTILS_LOGE("continue dataLength %{public}d", dataLength); + UTILS_LOGE("continue dataLength %{public}d, %{public}p", dataLength, &dataLength); size_t readCapacity = (static_cast(dataLength) + 1) * sizeof(char16_t); - UTILS_LOGE("done readCapacity %{public}zu", readCapacity); + UTILS_LOGE("done readCapacity %{public}zu, %{public}p", readCapacity, &readCapacity); if ((readCapacity > (static_cast(dataLength))) && (readCapacity <= GetReadableBytes())) { const uint8_t *str = ReadBuffer(readCapacity); if (str != nullptr) { -- Gitee