mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 12:10:47 +00:00
The code has security issues
Signed-off-by: hwx1163501 <hanjing35@huawei.com> issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7JY3Y
This commit is contained in:
parent
3545040542
commit
52fe048741
@ -124,7 +124,7 @@ void PGOTypeInfer::CollectGateType(CollectedType &types, GateType tsType, PGORWO
|
||||
{
|
||||
CheckAndInsert(types, tsType);
|
||||
|
||||
for (int i = 0; i < pgoTypes.GetCount(); i++) {
|
||||
for (uint32_t i = 0; i < pgoTypes.GetCount(); i++) {
|
||||
ClassType classType = pgoTypes.GetObjectInfo(i).GetClassType();
|
||||
GateType pgoType = tsManager_->GetGateTypeByPt(classType);
|
||||
if (tsManager_->IsClassTypeKind(pgoType) && !pgoTypes.GetObjectInfo(i).InConstructor()) {
|
||||
@ -247,7 +247,7 @@ void PGOTypeInfer::AddProfiler(GateRef gate, GateType tsType, PGORWOpType pgoTyp
|
||||
Profiler::Value value;
|
||||
value.gate = gate;
|
||||
value.tsType = tsType;
|
||||
for (int i = 0; i < pgoType.GetCount(); i++) {
|
||||
for (uint32_t i = 0; i < pgoType.GetCount(); i++) {
|
||||
value.pgoTypes.emplace_back(tsManager_->GetGateTypeByPt(pgoType.GetObjectInfo(i).GetClassType()));
|
||||
}
|
||||
for (GateType type : inferTypes) {
|
||||
|
@ -968,7 +968,7 @@ Local<JSValueRef> DebuggerApi::GetLinkedListValue(const EcmaVM *ecmaVm, Local<JS
|
||||
uint32_t size = static_cast<uint32_t>(linkedList->Length());
|
||||
Local<JSValueRef> jsValueRef = ArrayRef::New(ecmaVm, size);
|
||||
JSMutableHandle<JSTaggedValue> currentValue(thread, JSTaggedValue::Undefined());
|
||||
uint32_t valueNode = TaggedDoubleList::ELEMENTS_START_INDEX;
|
||||
int valueNode = TaggedDoubleList::ELEMENTS_START_INDEX;
|
||||
uint32_t index = 0;
|
||||
while (index < size) {
|
||||
valueNode = doubleList->GetNextDataIndex(valueNode);
|
||||
@ -988,7 +988,7 @@ Local<JSValueRef> DebuggerApi::GetListValue(const EcmaVM *ecmaVm, Local<JSValueR
|
||||
uint32_t size = static_cast<uint32_t>(list->Length());
|
||||
Local<JSValueRef> jsValueRef = ArrayRef::New(ecmaVm, size);
|
||||
JSMutableHandle<JSTaggedValue> currentValue(thread, JSTaggedValue::Undefined());
|
||||
uint32_t valueNode = TaggedDoubleList::ELEMENTS_START_INDEX;
|
||||
int valueNode = TaggedDoubleList::ELEMENTS_START_INDEX;
|
||||
uint32_t index = 0;
|
||||
while (index < size) {
|
||||
valueNode = singleList->GetNextDataIndex(valueNode);
|
||||
|
@ -78,7 +78,7 @@ JSHandle<JSAPIArrayList> JSAPIArrayList::Clone(JSThread *thread, const JSHandle<
|
||||
JSHandle<TaggedArray> srcElements(thread, obj->GetElements());
|
||||
ASSERT(!srcElements->IsDictionaryMode());
|
||||
|
||||
int32_t length = obj->GetSize();
|
||||
uint32_t length = obj->GetSize();
|
||||
auto factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPIArrayList> newArrayList = factory->NewJSAPIArrayList(0);
|
||||
newArrayList->SetLength(thread, JSTaggedValue(length));
|
||||
@ -253,7 +253,7 @@ JSTaggedValue JSAPIArrayList::ReplaceAllElements(JSThread *thread, const JSHandl
|
||||
const JSHandle<JSTaggedValue> &thisArg)
|
||||
{
|
||||
JSHandle<JSAPIArrayList> arrayList = JSHandle<JSAPIArrayList>::Cast(thisHandle);
|
||||
uint32_t length = static_cast<uint32_t>(arrayList->GetSize());
|
||||
uint32_t length = arrayList->GetSize();
|
||||
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
|
||||
JSMutableHandle<JSTaggedValue> kValue(thread, JSTaggedValue::Undefined());
|
||||
const int32_t argsLength = 3;
|
||||
@ -334,7 +334,7 @@ JSTaggedValue JSAPIArrayList::ForEach(JSThread *thread, const JSHandle<JSTaggedV
|
||||
const JSHandle<JSTaggedValue> &thisArg)
|
||||
{
|
||||
JSHandle<JSAPIArrayList> arrayList = JSHandle<JSAPIArrayList>::Cast(thisHandle);
|
||||
uint32_t length = static_cast<uint32_t>(arrayList->GetSize());
|
||||
uint32_t length = arrayList->GetSize();
|
||||
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
|
||||
JSMutableHandle<JSTaggedValue> kValue(thread, JSTaggedValue::Undefined());
|
||||
const int32_t argsLength = 3;
|
||||
@ -348,8 +348,8 @@ JSTaggedValue JSAPIArrayList::ForEach(JSThread *thread, const JSHandle<JSTaggedV
|
||||
info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisHandle.GetTaggedValue());
|
||||
JSTaggedValue funcResult = JSFunction::Call(info);
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, funcResult);
|
||||
if (static_cast<int>(length) != arrayList->GetSize()) {
|
||||
length = static_cast<uint32_t>(arrayList->GetSize());
|
||||
if (length != arrayList->GetSize()) {
|
||||
length = arrayList->GetSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
static bool SetProperty(JSThread *thread, const JSHandle<JSAPIArrayList> &obj,
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value);
|
||||
inline int GetSize() const
|
||||
inline uint32_t GetSize() const
|
||||
{
|
||||
return GetLength().GetInt();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ JSTaggedValue JSMap::Get(JSTaggedValue key) const
|
||||
return LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject())->Get(key);
|
||||
}
|
||||
|
||||
int JSMap::GetSize() const
|
||||
uint32_t JSMap::GetSize() const
|
||||
{
|
||||
return LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject())->NumberOfElements();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
JSTaggedValue Get(JSTaggedValue key) const;
|
||||
|
||||
int GetSize() const;
|
||||
uint32_t GetSize() const;
|
||||
|
||||
JSTaggedValue GetKey(int entry) const;
|
||||
|
||||
|
@ -56,7 +56,7 @@ bool JSSet::Has(JSTaggedValue value) const
|
||||
return LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject())->Has(value);
|
||||
}
|
||||
|
||||
int JSSet::GetSize() const
|
||||
uint32_t JSSet::GetSize() const
|
||||
{
|
||||
return LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject())->NumberOfElements();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
bool Has(JSTaggedValue value) const;
|
||||
|
||||
int GetSize() const;
|
||||
uint32_t GetSize() const;
|
||||
|
||||
JSTaggedValue GetValue(int entry) const;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <signal.h> // NOLINTNEXTLINE(modernize-deprecated-headers)
|
||||
#include <csignal>
|
||||
#include <vector>
|
||||
|
||||
#include "ecmascript/base/string_helper.h"
|
||||
|
@ -553,7 +553,7 @@ public:
|
||||
static Local<StringRef> NewFromUtf8(const EcmaVM *vm, const char *utf8, int length = -1);
|
||||
static Local<StringRef> NewFromUtf16(const EcmaVM *vm, const char16_t *utf16, int length = -1);
|
||||
std::string ToString();
|
||||
int32_t Length();
|
||||
uint32_t Length();
|
||||
int32_t Utf8Length(const EcmaVM *vm);
|
||||
int WriteUtf8(char *buffer, int length, bool isWriteBuffer = false);
|
||||
int WriteUtf16(char16_t *buffer, int length);
|
||||
@ -761,7 +761,7 @@ public:
|
||||
class PUBLIC_API ArrayRef : public ObjectRef {
|
||||
public:
|
||||
static Local<ArrayRef> New(const EcmaVM *vm, uint32_t length = 0);
|
||||
int32_t Length(const EcmaVM *vm);
|
||||
uint32_t Length(const EcmaVM *vm);
|
||||
static bool SetValueAt(const EcmaVM *vm, Local<JSValueRef> obj, uint32_t index, Local<JSValueRef> value);
|
||||
static Local<JSValueRef> GetValueAt(const EcmaVM *vm, Local<JSValueRef> obj, uint32_t index);
|
||||
};
|
||||
|
@ -1214,7 +1214,7 @@ std::string StringRef::ToString()
|
||||
return EcmaStringAccessor(JSNApiHelper::ToJSTaggedValue(this)).ToStdString();
|
||||
}
|
||||
|
||||
int32_t StringRef::Length()
|
||||
uint32_t StringRef::Length()
|
||||
{
|
||||
return EcmaStringAccessor(JSNApiHelper::ToJSTaggedValue(this)).GetLength();
|
||||
}
|
||||
@ -1856,7 +1856,7 @@ Local<ArrayRef> ArrayRef::New(const EcmaVM *vm, uint32_t length)
|
||||
return JSNApiHelper::ToLocal<ArrayRef>(array);
|
||||
}
|
||||
|
||||
int32_t ArrayRef::Length([[maybe_unused]] const EcmaVM *vm)
|
||||
uint32_t ArrayRef::Length([[maybe_unused]] const EcmaVM *vm)
|
||||
{
|
||||
CHECK_HAS_PENDING_EXCEPTION(vm, 0);
|
||||
return JSArray::Cast(JSNApiHelper::ToJSTaggedValue(this).GetTaggedObject())->GetArrayLength();
|
||||
|
@ -563,7 +563,7 @@ void PGOMethodTypeSet::RWScalarOpTypeInfo::ProcessToText(std::string &text) cons
|
||||
text += BLOCK_START;
|
||||
text += ARRAY_START + SPACE;
|
||||
bool isFirst = true;
|
||||
for (int i = 0; i < type_.GetCount(); i++) {
|
||||
for (uint32_t i = 0; i < type_.GetCount(); i++) {
|
||||
if (!isFirst) {
|
||||
text += TYPE_SEPARATOR + SPACE;
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ public:
|
||||
|
||||
void Merge(const PGORWOpType &type)
|
||||
{
|
||||
for (int i = 0; i < type.count_; i++) {
|
||||
for (uint32_t i = 0; i < type.count_; i++) {
|
||||
AddObjectInfo(type.infos_[i]);
|
||||
}
|
||||
}
|
||||
@ -368,13 +368,13 @@ public:
|
||||
if (info.IsNone()) {
|
||||
return;
|
||||
}
|
||||
int32_t count = 0;
|
||||
uint32_t count = 0;
|
||||
for (; count < count_; count++) {
|
||||
if (infos_[count] == info) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (count < POLY_CASE_NUM) {
|
||||
if (count < static_cast<uint32_t>(POLY_CASE_NUM)) {
|
||||
infos_[count] = info;
|
||||
count_++;
|
||||
} else {
|
||||
@ -382,20 +382,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
PGOObjectInfo GetObjectInfo(int32_t index) const
|
||||
PGOObjectInfo GetObjectInfo(uint32_t index) const
|
||||
{
|
||||
ASSERT(index < count_);
|
||||
return infos_[index];
|
||||
}
|
||||
|
||||
int32_t GetCount() const
|
||||
uint32_t GetCount() const
|
||||
{
|
||||
return count_;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr int POLY_CASE_NUM = 4;
|
||||
int count_ = 0;
|
||||
uint32_t count_ = 0;
|
||||
PGOObjectInfo infos_[POLY_CASE_NUM];
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
|
Loading…
Reference in New Issue
Block a user