From 7c78372566e0c119f9b86032bd24f80a74eb22ef Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 18 Nov 2022 09:12:33 -0800 Subject: [PATCH] Do not abort if a MultiFrameCodec is unable to allocate a bitmap buffer (flutter/engine#37534) Fixes https://github.com/flutter/flutter/issues/113014 --- engine/src/flutter/lib/ui/painting/multi_frame_codec.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/lib/ui/painting/multi_frame_codec.cc b/engine/src/flutter/lib/ui/painting/multi_frame_codec.cc index 3099a618b8..76af13ba16 100644 --- a/engine/src/flutter/lib/ui/painting/multi_frame_codec.cc +++ b/engine/src/flutter/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_);