Add error logging on invalid cmap - DO NOT MERGE
This patch logs instances of fonts with invalid cmap tables. Bug: 25645298 Bug: 26413177 Change-Id: I183985e9784a97a2b4307a22e036382b1fc90e5e
This commit is contained in:
@@ -20,6 +20,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define LOG_TAG "Minikin"
|
||||||
|
#include <cutils/log.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
@@ -68,6 +71,7 @@ static bool getCoverageFormat4(vector<uint32_t>& coverage, const uint8_t* data,
|
|||||||
uint32_t start = readU16(data, kHeaderSize + 2 * (segCount + i));
|
uint32_t start = readU16(data, kHeaderSize + 2 * (segCount + i));
|
||||||
if (end < start) {
|
if (end < start) {
|
||||||
// invalid segment range: size must be positive
|
// invalid segment range: size must be positive
|
||||||
|
android_errorWriteLog(0x534e4554, "26413177");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint32_t rangeOffset = readU16(data, kHeaderSize + 2 * (3 * segCount + i));
|
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);
|
uint32_t nGroups = readU32(data, kNGroupsOffset);
|
||||||
if (nGroups >= kMaxNGroups || kFirstGroupOffset + nGroups * kGroupSize > size) {
|
if (nGroups >= kMaxNGroups || kFirstGroupOffset + nGroups * kGroupSize > size) {
|
||||||
|
android_errorWriteLog(0x534e4554, "25645298");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < nGroups; i++) {
|
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);
|
uint32_t end = readU32(data, groupOffset + kEndCharCodeOffset);
|
||||||
if (end < start) {
|
if (end < start) {
|
||||||
// invalid group range: size must be positive
|
// invalid group range: size must be positive
|
||||||
|
android_errorWriteLog(0x534e4554, "26413177");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
addRange(coverage, start, end + 1); // file is inclusive, vector is exclusive
|
addRange(coverage, start, end + 1); // file is inclusive, vector is exclusive
|
||||||
|
|||||||
Reference in New Issue
Block a user