The following issues were found
Userland/Libraries/LibChess/UCIEndpoint.h
1 issues
Line: 17
namespace Chess::UCI {
class Endpoint : public Core::Object {
C_OBJECT(Endpoint)
public:
virtual ~Endpoint() override { }
Endpoint() { }
Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevice> out);
Reported by Cppcheck.
Tests/LibWasm/test-wasm.cpp
1 issues
Line: 19
Column: 29
CWE codes:
362
auto filename = vm.argument(0).to_string(global_object);
if (vm.exception())
return {};
auto file = Core::File::open(filename, Core::OpenMode::ReadOnly);
if (file.is_error()) {
vm.throw_exception<JS::TypeError>(global_object, file.error().string());
return {};
}
auto contents = file.value()->read_all();
Reported by FlawFinder.
Userland/Libraries/LibCompress/Deflate.h
1 issues
Line: 80
Column: 12
CWE codes:
120
20
DeflateDecompressor(InputStream&);
~DeflateDecompressor();
size_t read(Bytes) override;
bool read_or_error(Bytes) override;
bool discard_or_error(size_t) override;
bool unreliable_eof() const override;
bool handle_any_error() override;
Reported by FlawFinder.
Tests/LibRegex/RegexLibC.cpp
1 issues
Line: 1069
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
EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_EBRACK);
EXPECT_EQ(regexec(®ex, "asdf@asdf.com", 0, NULL, 0), REG_EBRACK);
char buf[1024];
size_t buflen = 1024;
auto len = regerror(0, ®ex, buf, buflen);
String expected = "Error during parsing of regular expression:\n ^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$\n ^---- [ ] imbalance.";
for (size_t i = 0; i < len; ++i) {
EXPECT_EQ(buf[i], expected[i]);
Reported by FlawFinder.
Userland/Libraries/LibCompress/Gzip.h
1 issues
Line: 45
Column: 12
CWE codes:
120
20
GzipDecompressor(InputStream&);
~GzipDecompressor();
size_t read(Bytes) override;
bool read_or_error(Bytes) override;
bool discard_or_error(size_t) override;
bool unreliable_eof() const override;
bool handle_any_error() override;
Reported by FlawFinder.
Tests/LibGfx/TestFontHandling.cpp
1 issues
Line: 146
Column: 12
CWE codes:
377
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
char path[] = "/tmp/new.font.XXXXXX";
EXPECT(mkstemp(path) != -1);
EXPECT(font->write_to_file(path));
unlink(path);
}
Reported by FlawFinder.
Userland/Utilities/tt.cpp
1 issues
Line: 111
Column: 9
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
pthread_mutex_lock(&mutex);
outln("Obnoxious spam!");
pthread_mutex_unlock(&mutex);
usleep(10000);
}
return 0;
}
int detached_test()
Reported by FlawFinder.
Userland/Libraries/LibCore/Command.cpp
1 issues
Line: 81
Column: 27
CWE codes:
362
auto read_all_from_pipe = [](int pipe[2]) {
auto result_file = Core::File::construct();
if (!result_file->open(pipe[0], Core::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) {
perror("open");
VERIFY_NOT_REACHED();
}
return String::copy(result_file->read_all());
};
Reported by FlawFinder.
Tests/LibCrypto/TestBigInteger.cpp
1 issues
Line: 424
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
TEST_CASE(test_bigint_big_endian_export)
{
auto number = "448378203247"_bigint;
char exported[8] { 0 };
auto exported_length = number.export_data({ exported, 8 }, true);
EXPECT_EQ(exported_length, 5u);
EXPECT(memcmp(exported + 3, "hello", 5) == 0);
}
Reported by FlawFinder.
Userland/Libraries/LibCore/ConfigFile.h
1 issues
Line: 23
Column: 38
CWE codes:
362
static NonnullRefPtr<ConfigFile> get_for_lib(const String& lib_name);
static NonnullRefPtr<ConfigFile> get_for_app(const String& app_name);
static NonnullRefPtr<ConfigFile> get_for_system(const String& app_name);
static NonnullRefPtr<ConfigFile> open(const String& path);
~ConfigFile();
bool has_group(const String&) const;
bool has_key(const String& group, const String& key) const;
Reported by FlawFinder.