LibGfx: Fix incorrect error handling in ICOLoader

This was found by OSS Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42188
This commit is contained in:
Brian Gianforcaro 2021-12-23 01:49:27 -08:00 committed by Brian Gianforcaro
parent da6aef9fff
commit 0a827eaa02
Notes: sideshowbarker 2024-07-17 22:18:29 +09:00

View file

@ -264,7 +264,7 @@ static bool load_ico_bitmap(ICOLoadingContext& context, Optional<size_t> index)
PNGImageDecoderPlugin png_decoder(context.data + desc.offset, desc.size);
if (png_decoder.sniff()) {
auto decoded_png_frame = png_decoder.frame(0);
if (!decoded_png_frame.is_error() || !decoded_png_frame.value().image) {
if (decoded_png_frame.is_error() || !decoded_png_frame.value().image) {
dbgln_if(ICO_DEBUG, "load_ico_bitmap: failed to load PNG encoded image index: {}", real_index);
return false;
}