提交 d60a48cc 编写于 作者: R Raph Levien 提交者: android-build-merger

Add error logging on invalid cmap - DO NOT MERGE

am: 48e53074

* commit '48e53074':
  Add error logging on invalid cmap - DO NOT MERGE
......@@ -19,6 +19,9 @@
#define LOG_TAG "Minikin"
#include <cutils/log.h>
#define LOG_TAG "Minikin"
#include <cutils/log.h>
#include <vector>
using std::vector;
......@@ -67,6 +70,7 @@ static bool getCoverageFormat4(vector<uint32_t>& coverage, const uint8_t* data,
uint32_t start = readU16(data, kHeaderSize + 2 * (segCount + i));
if (end < start) {
// invalid segment range: size must be positive
android_errorWriteLog(0x534e4554, "26413177");
return false;
}
uint32_t rangeOffset = readU16(data, kHeaderSize + 2 * (3 * segCount + i));
......@@ -113,6 +117,7 @@ static bool getCoverageFormat12(vector<uint32_t>& coverage, const uint8_t* data,
}
uint32_t nGroups = readU32(data, kNGroupsOffset);
if (nGroups >= kMaxNGroups || kFirstGroupOffset + nGroups * kGroupSize > size) {
android_errorWriteLog(0x534e4554, "25645298");
return false;
}
for (uint32_t i = 0; i < nGroups; i++) {
......@@ -121,6 +126,7 @@ static bool getCoverageFormat12(vector<uint32_t>& coverage, const uint8_t* data,
uint32_t end = readU32(data, groupOffset + kEndCharCodeOffset);
if (end < start) {
// invalid group range: size must be positive
android_errorWriteLog(0x534e4554, "26413177");
return false;
}
addRange(coverage, start, end + 1); // file is inclusive, vector is exclusive
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册