mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1656927 - Assertion failure: aContentType.Equals("image/avif"), at /builds/worker/checkouts/gecko/image/imgLoader.cpp:2785. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D85803
This commit is contained in:
parent
f468d1bd79
commit
eb0d0b2471
@ -2729,6 +2729,8 @@ imgLoader::GetMIMETypeFromContent(nsIRequest* aRequest,
|
||||
nsresult imgLoader::GetMimeTypeFromContent(const char* aContents,
|
||||
uint32_t aLength,
|
||||
nsACString& aContentType) {
|
||||
nsAutoCString detected;
|
||||
|
||||
/* Is it a GIF? */
|
||||
if (aLength >= 6 &&
|
||||
(!strncmp(aContents, "GIF87a", 6) || !strncmp(aContents, "GIF89a", 6))) {
|
||||
@ -2781,8 +2783,9 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents,
|
||||
aContentType.AssignLiteral(IMAGE_WEBP);
|
||||
|
||||
} else if (MatchesMP4(reinterpret_cast<const uint8_t*>(aContents), aLength,
|
||||
aContentType)) {
|
||||
MOZ_ASSERT(aContentType.Equals(IMAGE_AVIF));
|
||||
detected) &&
|
||||
detected.Equals(IMAGE_AVIF)) {
|
||||
aContentType.AssignLiteral(IMAGE_AVIF);
|
||||
} else {
|
||||
/* none of the above? I give up */
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
@ -87,6 +87,16 @@ TEST_F(ImageLoader, DetectAVIFCompatibleBrand) {
|
||||
CheckMimeType(buffer, sizeof(buffer), IMAGE_AVIF);
|
||||
}
|
||||
|
||||
TEST_F(ImageLoader, DetectNonImageMP4) {
|
||||
const char buffer[] =
|
||||
"\x00\x00\x00\x1c" // box length
|
||||
"ftyp" // box type
|
||||
"isom" // major brand
|
||||
"\x00\x00\x02\x00" // minor version
|
||||
"isomiso2mp41"; // compatible brands
|
||||
CheckMimeType(buffer, sizeof(buffer), nullptr);
|
||||
}
|
||||
|
||||
TEST_F(ImageLoader, DetectNone) {
|
||||
const char buffer[] = "abcdefghijklmnop";
|
||||
CheckMimeType(buffer, sizeof(buffer), nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user