LibImageDecoderClient: Gracefully recover from decoder crashes :^)

If the ImageDecoder service crashes while decoding an image for us,
we now recover gracefully and simply return null.

This shields the browser from bugs in our image decoders.
This commit is contained in:
Andreas Kling 2021-02-20 11:33:34 +01:00
parent a446cea759
commit 8fb9d1fd1d
Notes: sideshowbarker 2024-07-18 22:07:28 +09:00

View file

@ -56,7 +56,12 @@ Optional<DecodedImage> Client::decode_image(const ByteBuffer& encoded_data)
}
memcpy(encoded_buffer.data<void>(), encoded_data.data(), encoded_data.size());
auto response = send_sync<Messages::ImageDecoderServer::DecodeImage>(move(encoded_buffer));
auto response = send_sync_but_allow_failure<Messages::ImageDecoderServer::DecodeImage>(move(encoded_buffer));
if (!response) {
dbgln("ImageDecoder died heroically");
return {};
}
DecodedImage image;
image.is_animated = response->is_animated();