Cdm: Validate License Message type in parse_license
This commit is contained in:
parent
b081d66ca2
commit
ac469383b8
|
@ -211,6 +211,12 @@ class Cdm:
|
||||||
if not isinstance(license_message, SignedMessage):
|
if not isinstance(license_message, SignedMessage):
|
||||||
raise ValueError(f"Expecting license_response to be a SignedMessage, got {license_message!r}")
|
raise ValueError(f"Expecting license_response to be a SignedMessage, got {license_message!r}")
|
||||||
|
|
||||||
|
if license_message.type != SignedMessage.MessageType.LICENSE:
|
||||||
|
raise ValueError(
|
||||||
|
f"Expecting a LICENSE message, not a "
|
||||||
|
f"'{SignedMessage.MessageType.Name(license_message.type)}' message."
|
||||||
|
)
|
||||||
|
|
||||||
licence = License()
|
licence = License()
|
||||||
licence.ParseFromString(license_message.msg)
|
licence.ParseFromString(license_message.msg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue