Tests: Add regression tests for fixed OSS-Fuzz test cases
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/cb16c217b8 Pull-request: https://github.com/SerenityOS/serenity/pull/21541
|
@ -258,3 +258,16 @@ TEST_CASE(to_lab)
|
|||
EXPECT_APPROXIMATE_LAB(lab_from_sRGB(0, 255, 255), expected[6]);
|
||||
EXPECT_APPROXIMATE_LAB(lab_from_sRGB(255, 255, 255), expected[7]);
|
||||
}
|
||||
|
||||
TEST_CASE(malformed_profile)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("icc/oss-fuzz-testcase-60281.icc"sv)
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
auto profile_or_error = Gfx::ICC::Profile::try_load_from_externally_owned_memory(file->bytes());
|
||||
EXPECT(profile_or_error.is_error());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,21 @@ TEST_CASE(test_bmp_top_down)
|
|||
expect_single_frame(*plugin_decoder);
|
||||
}
|
||||
|
||||
TEST_CASE(test_ico_malformed_frame)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("ico/oss-fuzz-testcase-62541.ico"sv),
|
||||
TEST_INPUT("ico/oss-fuzz-testcase-63177.ico"sv)
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::ICOImageDecoderPlugin::create(file->bytes()));
|
||||
auto frame_or_error = plugin_decoder->frame(0);
|
||||
EXPECT(frame_or_error.is_error());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_gif)
|
||||
{
|
||||
auto file = MUST(Core::MappedFile::map(TEST_INPUT("download-animation.gif"sv)));
|
||||
|
@ -121,6 +136,33 @@ TEST_CASE(test_ilbm_uncompressed)
|
|||
EXPECT_EQ(frame.image->get_pixel(8, 0), Gfx::Color(0xee, 0xbb, 0, 255));
|
||||
}
|
||||
|
||||
TEST_CASE(test_ilbm_malformed_header)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("ilbm/oss-fuzz-testcase-62033.iff"sv),
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
auto plugin_decoder_or_error = Gfx::ILBMImageDecoderPlugin::create(file->bytes());
|
||||
EXPECT(plugin_decoder_or_error.is_error());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_ilbm_malformed_frame)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("ilbm/oss-fuzz-testcase-63296.iff"sv)
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));
|
||||
auto frame_or_error = plugin_decoder->frame(0);
|
||||
EXPECT(frame_or_error.is_error());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg_sof0_one_scan)
|
||||
{
|
||||
auto file = MUST(Core::MappedFile::map(TEST_INPUT("jpg/rgb24.jpg"sv)));
|
||||
|
@ -211,6 +253,33 @@ TEST_CASE(test_jpeg_grayscale_with_app14)
|
|||
expect_single_frame_of_size(*plugin_decoder, { 80, 80 });
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg_malformed_header)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("jpg/oss-fuzz-testcase-59785.jpg"sv)
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
auto plugin_decoder_or_error = Gfx::JPEGImageDecoderPlugin::create(file->bytes());
|
||||
EXPECT(plugin_decoder_or_error.is_error());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg_malformed_frame)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("jpg/oss-fuzz-testcase-62584.jpg"sv)
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::JPEGImageDecoderPlugin::create(file->bytes()));
|
||||
auto frame_or_error = plugin_decoder->frame(0);
|
||||
EXPECT(frame_or_error.is_error());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_pbm)
|
||||
{
|
||||
auto file = MUST(Core::MappedFile::map(TEST_INPUT("pnm/buggie-raw.pbm"sv)));
|
||||
|
@ -238,6 +307,21 @@ TEST_CASE(test_png)
|
|||
expect_single_frame(*plugin_decoder);
|
||||
}
|
||||
|
||||
TEST_CASE(test_png_malformed_frame)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("png/oss-fuzz-testcase-62371.png"sv),
|
||||
TEST_INPUT("png/oss-fuzz-testcase-63052.png"sv)
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::PNGImageDecoderPlugin::create(file->bytes()));
|
||||
auto frame_or_error = plugin_decoder->frame(0);
|
||||
EXPECT(frame_or_error.is_error());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_ppm)
|
||||
{
|
||||
auto file = MUST(Core::MappedFile::map(TEST_INPUT("pnm/buggie-raw.ppm"sv)));
|
||||
|
|
BIN
Tests/LibGfx/test-inputs/bmp/oss-fuzz-testcase-62541.bmp
Normal file
After Width: | Height: | Size: 138 B |
BIN
Tests/LibGfx/test-inputs/icc/oss-fuzz-testcase-60281.icc
Normal file
BIN
Tests/LibGfx/test-inputs/ico/oss-fuzz-testcase-62541.ico
Normal file
After Width: | Height: | Size: 138 B |
BIN
Tests/LibGfx/test-inputs/ico/oss-fuzz-testcase-63177.ico
Normal file
After Width: | Height: | Size: 184 B |
BIN
Tests/LibGfx/test-inputs/ilbm/oss-fuzz-testcase-62033.iff
Normal file
BIN
Tests/LibGfx/test-inputs/ilbm/oss-fuzz-testcase-63296.iff
Normal file
BIN
Tests/LibGfx/test-inputs/jpg/oss-fuzz-testcase-59785.jpg
Normal file
After Width: | Height: | Size: 26 B |
BIN
Tests/LibGfx/test-inputs/jpg/oss-fuzz-testcase-62584.jpg
Normal file
After Width: | Height: | Size: 47 B |
BIN
Tests/LibGfx/test-inputs/png/oss-fuzz-testcase-62371.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
Tests/LibGfx/test-inputs/png/oss-fuzz-testcase-63052.png
Normal file
After Width: | Height: | Size: 512 B |
|
@ -12,3 +12,7 @@ install(FILES vp9_4k.webm DESTINATION usr/Tests/LibVideo)
|
|||
install(FILES vp9_clamp_reference_mvs.webm DESTINATION usr/Tests/LibVideo)
|
||||
install(FILES vp9_oob_blocks.webm DESTINATION usr/Tests/LibVideo)
|
||||
install(FILES master_elements_containing_crc32.mkv DESTINATION usr/Tests/LibVideo)
|
||||
install(FILES oss-fuzz-testcase-52630.vp9 DESTINATION usr/Tests/LibVideo)
|
||||
install(FILES oss-fuzz-testcase-53977.vp9 DESTINATION usr/Tests/LibVideo)
|
||||
install(FILES oss-fuzz-testcase-62054.vp9 DESTINATION usr/Tests/LibVideo)
|
||||
install(FILES oss-fuzz-testcase-63182.vp9 DESTINATION usr/Tests/LibVideo)
|
||||
|
|
|
@ -59,6 +59,23 @@ TEST_CASE(vp9_oob_blocks)
|
|||
decode_video("./vp9_oob_blocks.webm"sv, 240);
|
||||
}
|
||||
|
||||
TEST_CASE(vp9_malformed_frame)
|
||||
{
|
||||
Array test_inputs = {
|
||||
"./oss-fuzz-testcase-52630.vp9"sv,
|
||||
"./oss-fuzz-testcase-53977.vp9"sv,
|
||||
"./oss-fuzz-testcase-62054.vp9"sv,
|
||||
"./oss-fuzz-testcase-63182.vp9"sv
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
auto file = MUST(Core::MappedFile::map(test_input));
|
||||
Video::VP9::Decoder vp9_decoder;
|
||||
auto maybe_decoder_error = vp9_decoder.receive_sample(file->bytes());
|
||||
EXPECT(maybe_decoder_error.is_error());
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK_CASE(vp9_4k)
|
||||
{
|
||||
decode_video("./vp9_4k.webm"sv, 2);
|
||||
|
|
BIN
Tests/LibVideo/oss-fuzz-testcase-52630.vp9
Normal file
BIN
Tests/LibVideo/oss-fuzz-testcase-53977.vp9
Normal file
1
Tests/LibVideo/oss-fuzz-testcase-62054.vp9
Normal file
|
@ -0,0 +1 @@
|
|||
‚I<EFBFBD>B˙
|