The following issues were found
Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp
1 issues
Line: 50
}
// 24.3.3.2 WeakMap.prototype.delete ( key ), https://tc39.es/ecma262/#sec-weakmap.prototype.delete
JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::delete_)
{
auto* weak_map = typed_this(vm, global_object);
if (!weak_map)
return {};
auto value = vm.argument(0);
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp
1 issues
Line: 32
}
// 26.1.3.2 WeakRef.prototype.deref ( ), https://tc39.es/ecma262/#sec-weak-ref.prototype.deref
JS_DEFINE_NATIVE_FUNCTION(WeakRefPrototype::deref)
{
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object)
return {};
if (!is<WeakRef>(this_object)) {
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp
1 issues
Line: 49
}
// 24.4.3.1 WeakSet.prototype.add ( value ), https://tc39.es/ecma262/#sec-weakset.prototype.add
JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::add)
{
auto* weak_set = typed_this(vm, global_object);
if (!weak_set)
return {};
auto value = vm.argument(0);
Reported by Cppcheck.
Userland/Libraries/LibKeyboard/CharacterMap.cpp
1 issues
Line: 46
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
Result<CharacterMap, OSError> CharacterMap::fetch_system_map()
{
CharacterMapData map_data;
char keymap_name[50 + 1] = { 0 };
if (getkeymap(keymap_name, sizeof(keymap_name), map_data.map, map_data.shift_map, map_data.alt_map, map_data.altgr_map, map_data.shift_altgr_map) < 0) {
return OSError(errno);
}
Reported by FlawFinder.
Userland/Libraries/LibKeyboard/CharacterMapFile.cpp
1 issues
Line: 26
Column: 11
CWE codes:
362
}
auto file = Core::File::construct(path);
file->open(Core::OpenMode::ReadOnly);
if (!file->is_open()) {
dbgln("Failed to open {}: {}", path, file->error_string());
return {};
}
Reported by FlawFinder.
Kernel/Storage/StorageManagement.cpp
1 issues
Line: 149
Column: 63
CWE codes:
126
VERIFY(!m_disk_partitions.is_empty());
VERIFY(m_boot_argument.starts_with("PARTUUID="));
auto partition_uuid = UUID(m_boot_argument.substring_view(strlen("PARTUUID=")));
if (partition_uuid.to_string().length() != 36) {
PANIC("StorageManagement: Specified partition UUID is not valid");
}
Reported by FlawFinder.
Kernel/Storage/StorageDevice.h
1 issues
Line: 27
Column: 31
CWE codes:
120
20
NonnullRefPtr<StorageController> controller() const;
// ^BlockDevice
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
virtual bool can_read(const FileDescription&, size_t) const override;
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
virtual bool can_write(const FileDescription&, size_t) const override;
// ^Device
Reported by FlawFinder.
Userland/Libraries/LibM/math.h
1 issues
Line: 316
float remquof(float x, float y, int* quo) NOEXCEPT;
long double remquol(long double x, long double y, int* quo) NOEXCEPT;
__END_DECLS
Reported by Cppcheck.
Userland/Libraries/LibPCIDB/Database.cpp
1 issues
Line: 15
Column: 28
CWE codes:
362
namespace PCIDB {
RefPtr<Database> Database::open(const String& filename)
{
auto file_or_error = MappedFile::map(filename);
if (file_or_error.is_error())
return nullptr;
auto res = adopt_ref(*new Database(file_or_error.release_value()));
Reported by FlawFinder.
Kernel/Storage/RamdiskDevice.cpp
1 issues
Line: 53
Column: 40
CWE codes:
120
20
if (request.request_type() == AsyncBlockDeviceRequest::Read) {
success = request.buffer().write(offset, length);
} else {
success = request.buffer().read(offset, length);
}
request.complete(success ? AsyncDeviceRequest::Success : AsyncDeviceRequest::MemoryFault);
}
}
Reported by FlawFinder.