Skip to content

Commit e5e82b9

Browse files
committed
Don't create a DataView for the "CFF " TrueType table in readTableEntry
Given that the "CFF " table may be replaced completely, during font-parsing, it shouldn't make sense to read and/or modify it piecewise.
1 parent b65eedc commit e5e82b9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/core/fonts.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,14 +1519,20 @@ class Font {
15191519
data[8] = data[9] = data[10] = data[11] = 0;
15201520
data[17] |= 0x20; // Set font optimized for cleartype flag.
15211521
}
1522+
// The "CFF " table may be replaced completely, hence its data shouldn't
1523+
// need to be read and/or modified piecewise through a `DataView`.
1524+
const view =
1525+
tag === "CFF "
1526+
? null
1527+
: new DataView(data.buffer, data.byteOffset, data.byteLength);
15221528

15231529
return {
15241530
tag,
15251531
checksum,
15261532
length,
15271533
offset,
15281534
data,
1529-
view: new DataView(data.buffer, data.byteOffset, data.byteLength),
1535+
view,
15301536
};
15311537
}
15321538

0 commit comments

Comments
 (0)