mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Avoid accidentally getting the entire font file in readNameTable
(issue 7020)
In the PDF file in question, some of the 'name' table entries have `record.length === 0`. This becomes problematic in the non-unicode case, since `font.getBytes(0)` will fetch the *entire* stream. Given that OTS rejects 'name' entries larger than `2^16`, this thus explain the sanitizer errors. Fixes 7020.
This commit is contained in:
parent
22341c0761
commit
505f15f221
4 changed files with 11 additions and 0 deletions
|
@ -1832,6 +1832,9 @@ var Font = (function FontClosure() {
|
|||
}
|
||||
for (i = 0, ii = records.length; i < ii; i++) {
|
||||
var record = records[i];
|
||||
if (record.length <= 0) {
|
||||
continue; // Nothing to process, ignoring.
|
||||
}
|
||||
var pos = start + stringsStart + record.offset;
|
||||
if (pos + record.length > end) {
|
||||
continue; // outside of name table, ignoring
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue