The following issues were found
Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp
1 issues
Line: 40
// 23.1.5.2.1 %ArrayIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
// FIXME: This seems to be CreateArrayIterator (https://tc39.es/ecma262/#sec-createarrayiterator) instead of %ArrayIteratorPrototype%.next.
JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<ArrayIterator>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotAn, "Array Iterator");
return {};
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
1 issues
Line: 163
}
// 23.1.3.7 Array.prototype.filter ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.filter
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::filter)
{
auto callback_function = vm.argument(0);
auto this_arg = vm.argument(1);
// 1. Let O be ? ToObject(this value).
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp
1 issues
Line: 137
}
// 25.4.3 Atomics.add ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.add
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::add)
{
auto* typed_array = typed_array_from(global_object, vm.argument(0));
if (!typed_array)
return {};
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp
1 issues
Line: 71
}
// 21.2.2.1 BigInt.asIntN ( bits, bigint ), https://tc39.es/ecma262/#sec-bigint.asintn
JS_DEFINE_NATIVE_FUNCTION(BigIntConstructor::as_int_n)
{
TODO();
}
// 21.2.2.2 BigInt.asUintN ( bits, bigint ), https://tc39.es/ecma262/#sec-bigint.asuintn
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
1 issues
Line: 51
}
// 21.2.3.3 BigInt.prototype.toString ( [ radix ] ), https://tc39.es/ecma262/#sec-bigint.prototype.tostring
JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_string)
{
auto bigint_value = this_bigint_value(global_object, vm.this_value(global_object));
if (vm.exception())
return {};
double radix = 10;
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp
1 issues
Line: 34
}
// 20.3.3.2 Boolean.prototype.toString ( ), https://tc39.es/ecma262/#sec-boolean.prototype.tostring
JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string)
{
auto this_value = vm.this_value(global_object);
if (this_value.is_boolean())
return js_string(vm, this_value.as_bool() ? "true" : "false");
if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) {
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/CommonPropertyNames.h
1 issues
Line: 315
Column: 7
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
P(proxy) \
P(push) \
P(race) \
P(random) \
P(raw) \
P(reduce) \
P(reduceRight) \
P(reject) \
P(repeat) \
Reported by FlawFinder.
Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp
1 issues
Line: 42
}
// 1.1.6. log(...data), https://console.spec.whatwg.org/#log
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::log)
{
return global_object.console().log();
}
// 1.1.3. debug(...data), https://console.spec.whatwg.org/#debug
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp
1 issues
Line: 155
}
// 25.3.4.5 DataView.prototype.getBigInt64 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getbigint64
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_big_int_64)
{
return get_view_value<i64>(global_object, vm.argument(0), vm.argument(1));
}
// 25.3.4.6 DataView.prototype.getBigUint64 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getbiguint64
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/DateConstructor.cpp
1 issues
Line: 295
}
// 21.4.3.1 Date.now ( ), https://tc39.es/ecma262/#sec-date.now
JS_DEFINE_NATIVE_FUNCTION(DateConstructor::now)
{
struct timeval tv;
gettimeofday(&tv, nullptr);
return Value(floor(tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0));
}
Reported by Cppcheck.