From 590a1022e88b475b39ecf5fe25a4fbd47af2db90 Mon Sep 17 00:00:00 2001 From: lwx1155083 Date: Mon, 27 Mar 2023 15:44:16 +0800 Subject: [PATCH] Issue:I6LQJS Test:NA Signed-off-by: lwx1155083 --- 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 441a4df..4d62353 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -1044,7 +1044,7 @@ bool Parcel::ReadString16(std::u16string &value) } size_t readCapacity = (static_cast(dataLength) + 1) * sizeof(char16_t); - if (readCapacity <= GetReadableBytes()) { + if ((readCapacity > (static_cast(dataLength))) && (readCapacity <= GetReadableBytes())) { const uint8_t *str = ReadBuffer(readCapacity); if (str != nullptr) { const auto *u16Str = reinterpret_cast(str); -- Gitee