From e36411cfafd60b7da41a9cb04dfce5c6be24665e Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 30 Jul 2022 05:13:30 +0100 Subject: [PATCH] Cdm: Clear context for the challenge once loaded This stops users from loading the license twice, which wouldn't do anything wrong, but without doing this context deletion we could possibly end up with a ton of memory that would likely go unused if the same Cdm session is used a lot for a long time. --- pywidevine/cdm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pywidevine/cdm.py b/pywidevine/cdm.py index c962b37..fc00502 100644 --- a/pywidevine/cdm.py +++ b/pywidevine/cdm.py @@ -256,6 +256,9 @@ class Cdm: """ Load Keys from a License Message from a License Server Response. + License Messages can only be loaded a single time. An InvalidContext error will + be raised if you attempt to parse a License Message more than once. + Parameters: session_id: Session identifier. license_message: A SignedMessage containing a License message. @@ -327,6 +330,8 @@ class Cdm: for key in licence.key ] + del session.context[licence.id.request_id] + def decrypt( self, session_id: bytes,