g复string.startsWith不合理断言

Signed-off-by: hwx1163501 <hanjing35@huawei.com>
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I9FON0
This commit is contained in:
hwx1163501 2024-04-11 09:42:53 +08:00
parent 13693445cd
commit fe3a70f5c9
3 changed files with 6 additions and 1 deletions

View File

@ -270,7 +270,7 @@ template<typename T1, typename T2>
bool IsSubStringAtSpan(Span<T1> &lhsSp, Span<T2> &rhsSp, uint32_t offset)
{
int rhsSize = static_cast<int>(rhsSp.size());
ASSERT(rhsSize + offset < lhsSp.size());
ASSERT(rhsSize + offset <= lhsSp.size());
for (int i = 0; i < rhsSize; ++i) {
auto left = static_cast<int32_t>(lhsSp[offset + i]);
auto right = static_cast<int32_t>(rhsSp[i]);

View File

@ -96,3 +96,4 @@ false
true
true
sub_string test success!
true

View File

@ -263,3 +263,7 @@ let arr = Array(14);
let tree_str = arr + 512;
tree_str.substring(0,arr.length);
print("sub_string test success!");
const v0 = [3.0,-1.5053];
const v4 = v0.join();
print(v4.startsWith(v4,v0))