mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
Fix arrayList fuzz bug
Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAONHC Signed-off-by: 王笑佳 <wangxiaojia5@huawei.com>
This commit is contained in:
parent
f87fd7f329
commit
2950293081
@ -119,6 +119,10 @@ void JSAPIArrayList::TrimToCurrentLength(JSThread *thread, const JSHandle<JSAPIA
|
||||
|
||||
JSTaggedValue JSAPIArrayList::Get(JSThread *thread, const uint32_t index)
|
||||
{
|
||||
if (GetLength().GetArrayLength() == 0) {
|
||||
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::RANGE_ERROR, "Container is empty");
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
||||
}
|
||||
if (index >= GetLength().GetArrayLength()) {
|
||||
ASSERT(GetLength().GetArrayLength() > 0);
|
||||
std::ostringstream oss;
|
||||
@ -280,6 +284,10 @@ JSTaggedValue JSAPIArrayList::ReplaceAllElements(JSThread *thread, const JSHandl
|
||||
|
||||
JSTaggedValue JSAPIArrayList::Set(JSThread *thread, const uint32_t index, JSTaggedValue value)
|
||||
{
|
||||
if (GetLength().GetArrayLength() == 0) {
|
||||
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::RANGE_ERROR, "Container is empty");
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
||||
}
|
||||
if (index >= GetLength().GetArrayLength()) {
|
||||
ASSERT(GetLength().GetArrayLength() > 0);
|
||||
std::ostringstream oss;
|
||||
|
@ -118,7 +118,7 @@ JSTaggedValue JSAPIQueue::Get(JSThread *thread, const uint32_t index)
|
||||
|
||||
JSTaggedValue JSAPIQueue::Set(JSThread *thread, const uint32_t index, JSTaggedValue value)
|
||||
{
|
||||
if (GetLength().GetArrayLength() <= 0) {
|
||||
if (GetLength().GetArrayLength() == 0) {
|
||||
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::RANGE_ERROR, "Container is empty");
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
||||
}
|
||||
|
@ -291,7 +291,17 @@ if (globalThis["ArkPrivate"] != undefined) {
|
||||
temp.add(val)
|
||||
})
|
||||
print(oldLen * 2 === v1.length)
|
||||
|
||||
const v3 = new arrayList();
|
||||
const v4 = [arrayList,arrayList];
|
||||
class C4{
|
||||
["100"] = v4
|
||||
}
|
||||
const v5 = new C4();
|
||||
try {
|
||||
Object.assign(v3,v5)
|
||||
} catch (error) {
|
||||
print(error)
|
||||
}
|
||||
if (!flag) {
|
||||
print("Test ArrayList success!!!");
|
||||
} else {
|
||||
|
@ -12,6 +12,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
true
|
||||
BusinessError: Container is empty
|
||||
Test ArrayList success!!!
|
||||
Test Deque success!!!
|
||||
{}
|
||||
|
Loading…
Reference in New Issue
Block a user