The following issues were found
Userland/Applications/SoundPlayer/AudioAlgorithms.cpp
1 issues
Line: 41
}
for (int len = 2; len <= n; len <<= 1) {
double ang = 2 * AK::Pi<double> / len * (invert ? -1 : 1);
Complex<double> wlen(AK::cos(ang), AK::sin(ang));
for (int i = 0; i < n; i += len) {
Complex<double> w = { 1., 0. };
for (int j = 0; j < len / 2; j++) {
Complex<double> u = data[i + j], v = data[i + j + len / 2] * w;
Reported by Cppcheck.
Userland/DevTools/Profiler/Profile.cpp
1 issues
Line: 217
Column: 16
CWE codes:
362
Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const StringView& path)
{
auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::ReadOnly))
return String::formatted("Unable to open {}, error: {}", path, file->error_string());
auto json = JsonValue::from_string(file->read_all());
if (!json.has_value() || !json.value().is_object())
return String { "Invalid perfcore format (not a JSON object)" };
Reported by FlawFinder.
Userland/Applications/Piano/WaveWidget.h
1 issues
Line: 15
class TrackManager;
class WaveWidget final : public GUI::Frame {
C_OBJECT(WaveWidget)
public:
virtual ~WaveWidget() override;
private:
explicit WaveWidget(TrackManager&);
Reported by Cppcheck.
Userland/DevTools/Profiler/main.cpp
1 issues
Line: 246
Column: 28
CWE codes:
362
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md"), "/bin/Help");
}));
help_menu.add_action(GUI::CommonActions::make_about_action("Profiler", app_icon, window));
window->show();
return app->exec();
Reported by FlawFinder.
Userland/DevTools/StateMachineGenerator/main.cpp
1 issues
Line: 221
Column: 38
CWE codes:
362
args_parser.add_positional_argument(path, "Path to parser description", "input", Core::ArgsParser::Required::Yes);
args_parser.parse(argc, argv);
auto file_or_error = Core::File::open(path, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
fprintf(stderr, "Cannot open %s\n", path);
}
auto content = file_or_error.value()->read_all();
Reported by FlawFinder.
Userland/Applications/Piano/TrackManager.cpp
1 issues
Line: 46
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
}
memcpy(m_current_back_buffer.data(), buffer.data(), buffer_size);
swap(m_current_front_buffer, m_current_back_buffer);
}
void TrackManager::reset()
{
Reported by FlawFinder.
Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp
1 issues
Line: 1479
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
u8 buffer[512];
size_t read_bytes = min(sizeof(buffer), size - offset);
mmu().copy_from_vm(buffer, initial_data + offset, read_bytes);
memcpy(tcb_region->data() + offset, buffer, read_bytes);
offset += read_bytes;
}
memset(tcb_region->shadow_data(), 0x01, size);
auto tls_region = make<SimpleRegion>(0, 4);
Reported by FlawFinder.
Userland/Applications/Piano/SamplerWidget.h
1 issues
Line: 14
class TrackManager;
class WaveEditor final : public GUI::Frame {
C_OBJECT(WaveEditor)
public:
virtual ~WaveEditor() override;
private:
explicit WaveEditor(TrackManager&);
Reported by Cppcheck.
Userland/DevTools/UserspaceEmulator/main.cpp
1 issues
Line: 63
Column: 31
CWE codes:
362
OwnPtr<OutputFileStream> profile_stream;
if (dump_profile) {
profile_output_file = fopen(profile_dump_path.characters(), "w+");
if (profile_output_file == nullptr) {
auto error_string = strerror(errno);
warnln("Failed to open '{}' for writing: {}", profile_dump_path, error_string);
return 1;
}
Reported by FlawFinder.
Userland/Utilities/groupadd.cpp
1 issues
Line: 71
Column: 20
CWE codes:
362
return 3;
}
FILE* grfile = fopen("/etc/group", "a");
if (!grfile) {
perror("failed to open /etc/group");
return 1;
}
Reported by FlawFinder.