Skip to content

Commit

Permalink
fix(pdfjs): Use allowlist for exporting font data (#1414)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Chan authored Jul 29, 2021
1 parent ea95b91 commit 8dea22e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 10 deletions.
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
55 changes: 49 additions & 6 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,13 +35724,14 @@ 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), that = this;
EXPORT_DATA_PROPERTIES.forEach(function (property) {
var value = that[property];
// Ignore properties that haven't been explicitly set.
if (value !== undefined) {
data[property] = value;
}
}
});

return data;
},
Expand Down
7 changes: 4 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.

0 comments on commit 8dea22e

Please sign in to comment.