From 0297ee985c26b49fc2a3b0941db354c27f436bbf Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Thu, 29 May 2014 14:01:18 -0700 Subject: [PATCH] Fix for Minikin native crash The context start offset wasn't being taken into account for accumulating the advance values, leading in some cases to array index overflow. This is a fix for bug 15327918 "SIGSEGV in android::MinikinFontSkia::GetSkTypeface()" Change-Id: I9b646785724c9b72d862b822cd84661c106fbe52 --- libs/minikin/Layout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/minikin/Layout.cpp b/libs/minikin/Layout.cpp index 3935eb761c..aba8a1c7ab 100644 --- a/libs/minikin/Layout.cpp +++ b/libs/minikin/Layout.cpp @@ -661,7 +661,7 @@ void Layout::doLayoutRun(const uint16_t* buf, size_t start, size_t count, size_t ctx->paint.font->GetBounds(&glyphBounds, glyph_ix, ctx->paint); glyphBounds.offset(x + xoff, y + yoff); mBounds.join(glyphBounds); - size_t cluster = info[i].cluster; + size_t cluster = info[i].cluster - start; mAdvances[cluster] += xAdvance; x += xAdvance; } -- GitLab