From 7657c2ed1a792407b0c79bc5a746ff68503b4a02 Mon Sep 17 00:00:00 2001 From: wb9688 Date: Sat, 15 Aug 2020 17:08:07 +0200 Subject: [PATCH] Use initSafeStandardsObjects() --- .../youtube/extractors/YoutubeStreamExtractor.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 93bd2121e..b5c6c796a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -627,7 +627,6 @@ public class YoutubeStreamExtractor extends StreamExtractor { "yt\\.akamaized\\.net/\\)\\s*\\|\\|\\s*.*?\\s*c\\s*&&\\s*d\\.set\\([^,]+\\s*,\\s*(:encodeURIComponent\\s*\\()([a-zA-Z0-9$]+)\\(", "\\bc\\s*&&\\s*d\\.set\\([^,]+\\s*,\\s*(:encodeURIComponent\\s*\\()([a-zA-Z0-9$]+)\\(" }; - ; private volatile String decryptionCode = ""; @@ -788,16 +787,16 @@ public class YoutubeStreamExtractor extends StreamExtractor { } private String decryptSignature(String encryptedSig, String decryptionCode) throws DecryptException { - Context context = Context.enter(); + final Context context = Context.enter(); context.setOptimizationLevel(-1); - Object result; + final Object result; try { - ScriptableObject scope = context.initStandardObjects(); + final ScriptableObject scope = context.initSafeStandardObjects(); context.evaluateString(scope, decryptionCode, "decryptionCode", 1, null); - Function decryptionFunc = (Function) scope.get("decrypt", scope); + final Function decryptionFunc = (Function) scope.get("decrypt", scope); result = decryptionFunc.call(context, scope, scope, new Object[]{encryptedSig}); } catch (Exception e) { - throw new DecryptException("could not get decrypt signature", e); + throw new DecryptException("Could not get decrypt signature", e); } finally { Context.exit(); }