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
This commit is contained in:
Raph Levien
2014-05-29 14:01:18 -07:00
parent 9c5d659d5f
commit e1a0422aae

View File

@@ -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;
}