Bug 1780834. If a webp file header specifies ICCP but no ICCP chunk is found just ignore it and continue. r=aosmond

Differential Revision: https://phabricator.services.mozilla.com/D152588
This commit is contained in:
Timothy Nikkel 2022-07-26 08:24:27 +00:00
parent c793385bec
commit b5a9365200
5 changed files with 16 additions and 7 deletions

View file

@ -361,14 +361,19 @@ LexerResult nsWebPDecoder::ReadHeader(WebPDemuxer* aDemuxer, bool aIsComplete) {
if (!IsMetadataDecode() && !mGotColorProfile) {
if (flags & WebPFeatureFlags::ICCP_FLAG) {
WebPChunkIterator iter;
if (!WebPDemuxGetChunk(aDemuxer, "ICCP", 1, &iter)) {
return aIsComplete ? LexerResult(TerminalState::FAILURE)
: LexerResult(Yield::NEED_MORE_DATA);
}
if (WebPDemuxGetChunk(aDemuxer, "ICCP", 1, &iter)) {
ApplyColorProfile(reinterpret_cast<const char*>(iter.chunk.bytes),
iter.chunk.size);
WebPDemuxReleaseChunkIterator(&iter);
ApplyColorProfile(reinterpret_cast<const char*>(iter.chunk.bytes),
iter.chunk.size);
WebPDemuxReleaseChunkIterator(&iter);
} else {
MOZ_LOG(sWebPLog, LogLevel::Warning,
("[this=%p] nsWebPDecoder::ReadHeader header specified ICCP "
"but no ICCP chunk found, ignoring\n",
this));
ApplyColorProfile(nullptr, 0);
}
} else {
ApplyColorProfile(nullptr, 0);
}

View file

@ -51,3 +51,6 @@ skip-if(useDrawSnapshot) include downscaling/reftest.list
# Lossless encoders
include encoders-lossless/reftest.list
# webp tests
include webp/reftest.list

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

View file

@ -0,0 +1 @@
== icc-bit-no-icc-chunk.webp blue.png