Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pdfjs): Use allowlist for exporting font data #1414

Merged
merged 4 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const PDFJS_MAX_AUTO_SCALE = 1.25; // Should match MAX_AUTO_SCALE in pdf_
export const PDFJS_WIDTH_PADDING_PX = 40; // Should match SCROLLBAR_PADDING in pdf_viewer.js
export const PDFJS_HEIGHT_PADDING_PX = 5; // Should match VERTICAL_PADDING in pdf_viewer.js

export const DOC_STATIC_ASSETS_VERSION = '2.16.0'; // v2.53.0 has font rendering issues in large documents in MS Edge
export const DOC_STATIC_ASSETS_VERSION = '2.76.0';
export const MEDIA_STATIC_ASSETS_VERSION = '2.66.0';
export const MODEL3D_STATIC_ASSETS_VERSION = '1.12.0';
export const SWF_STATIC_ASSETS_VERSION = '0.112.0';
Expand Down
54 changes: 49 additions & 5 deletions src/third-party/doc/2.76.0/pdf.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34739,6 +34739,48 @@ var PRIVATE_USE_AREAS = [[0xE000, 0xF8FF], [0x100000, 0x10FFFD]];
var PDF_GLYPH_SPACE_UNITS = 1000;
var SEAC_ANALYSIS_ENABLED = true;
exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
var EXPORT_DATA_PROPERTIES = [
"_shadowWidth",
"ascent",
"bbox",
"black",
"bold",
"cMap",
"charProcOperatorList",
"charsCache",
"cidEncoding",
"composite",
"data",
"defaultEncoding",
"defaultVMetrics",
"defaultWidth",
"descent",
"differences",
"fallbackName",
"fallbackToUnicode",
"fontMatrix",
"fontType",
"glyphCache",
"isMonospace",
"isOpenType",
"isSerifFont",
"isSymbolicFont",
"isType3Font",
"italic",
"loadedName",
"mimetype",
"missingFile",
"name",
"remeasure",
"seacMap",
"subtype",
"toFontChar",
"toUnicode",
"type",
"vertical",
"vmetrics",
];
exports.EXPORT_DATA_PROPERTIES = EXPORT_DATA_PROPERTIES;
var FontFlags = {
FixedPitch: 1,
Serif: 2,
Expand Down Expand Up @@ -35682,11 +35724,13 @@ var Font = function FontClosure() {
},

exportData: function Font_exportData() {
var data = {};

for (var i in this) {
if (this.hasOwnProperty(i)) {
data[i] = this[i];
var data = Object.create(null);
ConradJChan marked this conversation as resolved.
Show resolved Hide resolved
var property, value;
ConradJChan marked this conversation as resolved.
Show resolved Hide resolved
for (property of EXPORT_DATA_PROPERTIES) {
value = this[property];
ConradJChan marked this conversation as resolved.
Show resolved Hide resolved
// Ignore properties that haven't been explicitly set.
if (value !== undefined) {
data[property] = value;
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/third-party/doc/2.76.0/pdf.worker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.