From 72fe9422c869b7878240a23e4650d9d90edb1c2a Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Fri, 23 May 2014 22:44:35 -0700 Subject: Fix native crash in Latin-1 typefaces This is a fix for bug 15171911 Timely crashes (native crash in libminikin) when I go to add a new alarm This patch fixes an off-by-one error that caused typefaces with only one page of Unicode coverage (ASCII or Latin-1) to have nPages = 0 instead of the correct value of 1 in the corresponding FontCollection. Change-Id: Id8be0c9e5713b8af22d863992921ee6382416a34 --- libs/minikin/FontCollection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/minikin/FontCollection.cpp b/libs/minikin/FontCollection.cpp index cd7b19e..8919dc1 100644 --- a/libs/minikin/FontCollection.cpp +++ b/libs/minikin/FontCollection.cpp @@ -66,7 +66,7 @@ FontCollection::FontCollection(const vector& typefaces) : mMaxChar = max(mMaxChar, instance->mCoverage->length()); lastChar.push_back(instance->mCoverage->nextSetBit(0)); } - size_t nPages = mMaxChar >> kLogCharsPerPage; + size_t nPages = (mMaxChar + kPageMask) >> kLogCharsPerPage; size_t offset = 0; for (size_t i = 0; i < nPages; i++) { Range dummy; -- cgit v1.2.3