From d821ad3562a55c028fbe3342e821ee31cfc09f83 Mon Sep 17 00:00:00 2001 From: p0358 Date: Sat, 28 Sep 2024 18:11:59 +0200 Subject: [PATCH] Limit max size of a single fallback font file for ASS to 20 MB It used to be limited to 20 MB total previously. We cannot easily limit total size of fonts anymore, so the least we can do is to keep the size of a single font file in check. --- src/plugins/htmlVideoPlayer/plugin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 337b8b3e56..f616723f87 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1304,6 +1304,7 @@ export class HtmlVideoPlayer { const availableFonts = {}; fontFiles.forEach(font => { if (!font.FamilyName) return; + if (font.Size > 20 * 1024 * 1024) return; // max 20 MB for any single font file const familyNameLower = font.FamilyName.trim().toLowerCase(); if (!(familyNameLower in availableFonts)) { const fontUrl = apiClient.getUrl(`/FallbackFont/Fonts/${encodeURIComponent(font.Name)}`, {