From e2f419702024f0cf707ac137967304fd8a606273 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 11 Nov 2022 14:22:48 -0800 Subject: [PATCH] Do not abort if a MultiFrameCodec is unable to allocate a bitmap buffer Fixes https://github.com/flutter/flutter/issues/113014 --- lib/ui/painting/multi_frame_codec.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ui/painting/multi_frame_codec.cc b/lib/ui/painting/multi_frame_codec.cc index 3099a618b8c61..76af13ba161fa 100644 --- a/lib/ui/painting/multi_frame_codec.cc +++ b/lib/ui/painting/multi_frame_codec.cc @@ -93,7 +93,11 @@ sk_sp MultiFrameCodec::State::GetNextFrameImage( SkImageInfo updated = info.makeAlphaType(kPremul_SkAlphaType); info = updated; } - bitmap.allocPixels(info); + if (!bitmap.tryAllocPixels(info)) { + FML_LOG(ERROR) << "Failed to allocate memory for bitmap of size " + << info.computeMinByteSize() << "B"; + return nullptr; + } ImageGenerator::FrameInfo frameInfo = generator_->GetFrameInfo(nextFrameIndex_);