[M108 Migration] Fix crashes observed during browser / renderer exit 82/286982/3
authorv-saha <v.saha@samsung.com>
Fri, 6 Jan 2023 06:25:05 +0000 (11:55 +0530)
committerBot Blink <blinkbot@samsung.com>
Wed, 18 Jan 2023 08:57:02 +0000 (08:57 +0000)
This patch fixes crashes related to VD Fonts iterator and NativeTCT

Reference: https://review.tizen.org/gerrit/277645

Change-Id: Ic76f2b365c63507f446c538240774b9629b76b2e
Signed-off-by: v-saha <v.saha@samsung.com>
third_party/blink/renderer/platform/fonts/font_fallback_iterator.cc
third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc

index bb6625f..256fcf4 100644 (file)
@@ -154,7 +154,11 @@ scoped_refptr<FontDataForRangeSet> FontFallbackIterator::Next(
   if (fallback_stage_ == kFirstCandidateForNotdefGlyph) {
     fallback_stage_ = kOutOfLuck;
     if (!first_candidate_)
+#if BUILDFLAG(IS_TIZEN)
+      return nullptr;
+#else
       FontCache::CrashWithFontInfo(&font_description_);
+#endif
     return first_candidate_;
   }
 
index b480215..c55d58e 100644 (file)
@@ -788,6 +788,12 @@ void HarfBuzzShaper::ShapeSegment(
 
       current_font_data_for_range_set =
           fallback_iterator.Next(fallback_chars_hint);
+#if BUILDFLAG(IS_TIZEN)
+      if (!current_font_data_for_range_set) {
+        hb_buffer_reset(range_data->buffer);
+        break;
+      }
+#endif
       if (!current_font_data_for_range_set->FontData()) {
         DCHECK(range_data->reshape_queue.empty());
         break;
@@ -796,6 +802,13 @@ void HarfBuzzShaper::ShapeSegment(
       continue;
     }
 
+#if BUILDFLAG(IS_TIZEN)
+    if (!current_font_data_for_range_set ||
+        !current_font_data_for_range_set->FontData()) {
+      break;
+    }
+#endif
+
     const SimpleFontData* font_data =
         current_font_data_for_range_set->FontData();
     SmallCapsIterator::SmallCapsBehavior small_caps_behavior =