The following issues were found
Userland/Libraries/LibJS/Runtime/MapPrototype.cpp
1 issues
Line: 58
}
// 24.1.3.1 Map.prototype.clear ( ), https://tc39.es/ecma262/#sec-map.prototype.clear
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::clear)
{
auto* map = typed_this(vm, global_object);
if (!map)
return {};
map->entries().clear();
Reported by Cppcheck.
Kernel/Syscalls/access.cpp
1 issues
Line: 20
Column: 37
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
return VirtualFileSystem::the().access(path.value()->view(), mode, current_directory());
}
}
Reported by FlawFinder.
Userland/Libraries/LibJS/Runtime/MathObject.h
1 issues
Line: 23
Column: 32
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
private:
JS_DECLARE_NATIVE_FUNCTION(abs);
JS_DECLARE_NATIVE_FUNCTION(random);
JS_DECLARE_NATIVE_FUNCTION(sqrt);
JS_DECLARE_NATIVE_FUNCTION(floor);
JS_DECLARE_NATIVE_FUNCTION(ceil);
JS_DECLARE_NATIVE_FUNCTION(round);
JS_DECLARE_NATIVE_FUNCTION(max);
Reported by FlawFinder.
Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp
1 issues
Line: 110
}
// 21.1.2.2 Number.isFinite ( number ), https://tc39.es/ecma262/#sec-number.isfinite
JS_DEFINE_NATIVE_FUNCTION(NumberConstructor::is_finite)
{
return Value(vm.argument(0).is_finite_number());
}
// 21.1.2.3 Number.isInteger ( number ), https://tc39.es/ecma262/#sec-number.isinteger
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp
1 issues
Line: 60
}
// 21.1.3.3 Number.prototype.toFixed ( fractionDigits ), https://tc39.es/ecma262/#sec-number.prototype.tofixed
JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_fixed)
{
auto number_value = this_number_value(global_object, vm.this_value(global_object));
if (vm.exception())
return {};
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
1 issues
Line: 121
}
// 20.1.2.10 Object.getOwnPropertyNames ( O ), https://tc39.es/ecma262/#sec-object.getownpropertynames
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names)
{
// 1. Return ? GetOwnPropertyKeys(O, string).
return get_own_property_keys(global_object, vm.argument(0), GetOwnPropertyKeysType::String);
}
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp
1 issues
Line: 61
}
// 20.1.3.2 Object.prototype.hasOwnProperty ( V ), https://tc39.es/ecma262/#sec-object.prototype.hasownproperty
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
{
auto property_key = vm.argument(0).to_property_key(global_object);
if (vm.exception())
return {};
auto* this_object = vm.this_value(global_object).to_object(global_object);
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp
1 issues
Line: 81
}
// 27.2.4.1 Promise.all ( iterable ), https://tc39.es/ecma262/#sec-promise.all
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all)
{
TODO();
}
// 27.2.4.2 Promise.allSettled ( iterable ), https://tc39.es/ecma262/#sec-promise.allsettled
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp
1 issues
Line: 51
}
// 27.2.5.4 Promise.prototype.then ( onFulfilled, onRejected ), https://tc39.es/ecma262/#sec-promise.prototype.then
JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::then)
{
auto* promise = promise_from(vm, global_object);
if (!promise)
return {};
auto on_fulfilled = vm.argument(0);
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp
1 issues
Line: 66
}
// 28.2.2.1 Proxy.revocable ( target, handler ), https://tc39.es/ecma262/#sec-proxy.revocable
JS_DEFINE_NATIVE_FUNCTION(ProxyConstructor::revocable)
{
auto* proxy = proxy_create(global_object, vm.argument(0), vm.argument(1));
if (vm.exception())
return {};
Reported by Cppcheck.