nuxt-og-image 7.0.4 → 7.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -2,6 +2,9 @@ const WOFF_HEADER_SIZE = 44;
|
|
|
2
2
|
const WOFF_TABLE_ENTRY_SIZE = 20;
|
|
3
3
|
const SFNT_TABLE_RECORD_SIZE = 16;
|
|
4
4
|
const MAX_SFNT_SIZE = 64 * 1024 * 1024;
|
|
5
|
+
function alignTableSize(size) {
|
|
6
|
+
return Math.ceil(size / 4) * 4;
|
|
7
|
+
}
|
|
5
8
|
const SIGNATURES = {
|
|
6
9
|
truetype: 65536,
|
|
7
10
|
appleTrueType: 1953658213,
|
|
@@ -71,10 +74,10 @@ async function decodeWoff(woff) {
|
|
|
71
74
|
throw new Error("a WOFF table runs past the end of the file");
|
|
72
75
|
if (table.compLength > table.origLength)
|
|
73
76
|
throw new Error("a WOFF table is larger than its decoded size");
|
|
74
|
-
sfntSize += table.origLength
|
|
77
|
+
sfntSize += alignTableSize(table.origLength);
|
|
78
|
+
if (sfntSize > MAX_SFNT_SIZE)
|
|
79
|
+
throw new Error(`the decoded font exceeds ${MAX_SFNT_SIZE} bytes`);
|
|
75
80
|
}
|
|
76
|
-
if (sfntSize > MAX_SFNT_SIZE)
|
|
77
|
-
throw new Error(`the decoded font exceeds ${MAX_SFNT_SIZE} bytes`);
|
|
78
81
|
const tableData = await Promise.all(tables.map((table) => {
|
|
79
82
|
const stored = woff.subarray(table.offset, table.offset + table.compLength);
|
|
80
83
|
return table.compLength < table.origLength ? inflate(stored, table.origLength) : stored;
|
|
@@ -96,7 +99,7 @@ async function decodeWoff(woff) {
|
|
|
96
99
|
out.setUint32(record + 8, offset);
|
|
97
100
|
out.setUint32(record + 12, table.origLength);
|
|
98
101
|
sfnt.set(tableData[index], offset);
|
|
99
|
-
offset += table.origLength
|
|
102
|
+
offset += alignTableSize(table.origLength);
|
|
100
103
|
});
|
|
101
104
|
return sfnt;
|
|
102
105
|
}
|