From b07894f7dc6779a0587e0fa3e46f79912cc47bde Mon Sep 17 00:00:00 2001 From: leiiyb Date: Sat, 21 Sep 2024 17:24:37 +0800 Subject: [PATCH] fix bug Signed-off-by: leiiyb --- frameworks/native/rdb/src/raw_data_parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/native/rdb/src/raw_data_parser.cpp b/frameworks/native/rdb/src/raw_data_parser.cpp index 44b0a361b..15d31650b 100644 --- a/frameworks/native/rdb/src/raw_data_parser.cpp +++ b/frameworks/native/rdb/src/raw_data_parser.cpp @@ -163,7 +163,7 @@ size_t RawDataParser::ParserRawData(const uint8_t* data, size_t length, BigInteg uint64_t count = Endian::LeToH(*(reinterpret_cast(alignData + used))); used += sizeof(uint64_t); - if (sizeof(uint64_t) * count > length - used) { + if (count > (length - used) / sizeof(uint64_t)) { return 0; } const uint64_t *temp = (reinterpret_cast(alignData + used)); @@ -201,7 +201,7 @@ size_t RawDataParser::ParserRawData(const uint8_t* data, size_t length, RawDataP uint32_t count = Endian::LeToH(*(reinterpret_cast(alignData + used))); used += sizeof(uint32_t); - if (sizeof(float) * count > length - used) { + if (count > (length - used) / sizeof(float)) { return 0; } auto values = reinterpret_cast(alignData + used);