Skip to content

Commit

Permalink
Add tests for Chromium bugs 334281983, 334682511 (#2159)
Browse files Browse the repository at this point in the history
Reporter credit: Yisumi, Shiyan Peng

The bug was fixed in #2123.

Bug: b/335555272
Bug: chromium:334281983, chromium:334682511
  • Loading branch information
wantehchang committed May 13, 2024
1 parent 5d97130 commit 67230c5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/gtest/avifdecodetest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ TEST(AvifDecodeTest, ParseEmptyData) {
ASSERT_EQ(avifDecoderParse(decoder.get()), AVIF_RESULT_INVALID_FTYP);
}

// From https://crbug.com/334281983.
TEST(AvifDecodeTest, PeekCompatibleFileTypeBad1) {
constexpr uint8_t kData[] = {0x00, 0x00, 0x00, 0x1c, 0x66,
0x74, 0x79, 0x70, 0x84, 0xca};
avifROData input = {kData, sizeof(kData)};
EXPECT_FALSE(avifPeekCompatibleFileType(&input));
}

// From https://crbug.com/334682511.
TEST(AvifDecodeTest, PeekCompatibleFileTypeBad2) {
constexpr uint8_t kData[] = {0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79,
0x70, 0x61, 0x73, 0x31, 0x6d, 0x00, 0x00,
0x08, 0x00, 0xd7, 0x89, 0xdb, 0x7f};
avifROData input = {kData, sizeof(kData)};
EXPECT_FALSE(avifPeekCompatibleFileType(&input));
}

} // namespace
} // namespace avif

Expand Down

0 comments on commit 67230c5

Please sign in to comment.