mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibGfx: Don't assume that image decoder plugin creation succeeds
An image with an incorrect header should fail at this step, so we have
to handle that without crashing.
This should have been done in 7b72bf29.
This commit is contained in:
committed by
Sam Atkins
parent
f9e62bc947
commit
3752facfbc
Notes:
sideshowbarker
2024-07-17 05:02:35 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/3752facfbc Pull-request: https://github.com/SerenityOS/serenity/pull/20076 Issue: https://github.com/SerenityOS/serenity/issues/19893 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -75,9 +75,11 @@ static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin_with_kn
|
||||
auto validation_result = plugin.validate_before_create(bytes).release_value_but_fixme_should_propagate_errors();
|
||||
if (!validation_result)
|
||||
continue;
|
||||
auto plugin_decoder = plugin.create(bytes).release_value_but_fixme_should_propagate_errors();
|
||||
if (!plugin_decoder->initialize().is_error())
|
||||
return plugin_decoder;
|
||||
auto plugin_decoder = plugin.create(bytes);
|
||||
if (!plugin_decoder.is_error()) {
|
||||
if (!plugin_decoder.value()->initialize().is_error())
|
||||
return plugin_decoder.release_value();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user