Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Uint8Array believed to be an ArrayBuffer when blacklisting based on key-id #889

Merged
merged 1 commit into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/eme/check_key_statuses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ export default function checkKeyStatuses(
session : MediaKeySession | ICustomMediaKeySession,
options: IKeyStatusesCheckingOptions,
keySystem: string
) : [IEMEWarningEvent[], ArrayBuffer[]] {
) : [IEMEWarningEvent[], Uint8Array[]] {
const warnings : IEMEWarningEvent[] = [];
const blacklistedKeyIDs : ArrayBuffer[] = [];
const blacklistedKeyIDs : Uint8Array[] = [];
const { fallbackOn = {}, throwOnLicenseExpiration } = options;

/* eslint-disable @typescript-eslint/no-unsafe-member-access */
Expand Down
2 changes: 1 addition & 1 deletion src/core/eme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export interface ISessionUpdatedEvent {
// blacklisted.
// Emit the corresponding keyIDs as payload.
export interface IBlacklistKeysEvent { type : "blacklist-keys";
value: ArrayBuffer[]; }
value: Uint8Array[]; }

/**
* Event Emitted when specific "protection data" cannot be deciphered and is thus
Expand Down
5 changes: 2 additions & 3 deletions src/manifest/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { ICustomError } from "../errors";
import { IParsedManifest } from "../parsers/manifest";
import areArraysOfNumbersEqual from "../utils/are_arrays_of_numbers_equal";
import arrayFind from "../utils/array_find";
import { isABEqualBytes } from "../utils/byte_parsing";
import EventEmitter from "../utils/event_emitter";
import idGenerator from "../utils/id_generator";
import warnOnce from "../utils/warn_once";
Expand Down Expand Up @@ -472,7 +471,7 @@ export default class Manifest extends EventEmitter<IManifestEvents> {
* performed.
* @param {Array.<ArrayBuffer>} keyIDs
*/
public addUndecipherableKIDs(keyIDs : ArrayBuffer[]) : void {
public addUndecipherableKIDs(keyIDs : Uint8Array[]) : void {
const updates = updateDeciperability(this, (representation) => {
if (representation.decipherable === false ||
representation.contentProtections === undefined)
Expand All @@ -483,7 +482,7 @@ export default class Manifest extends EventEmitter<IManifestEvents> {
for (let i = 0; i < contentKIDs.length; i++) {
const elt = contentKIDs[i];
for (let j = 0; j < keyIDs.length; j++) {
if (isABEqualBytes(keyIDs[j], elt.keyId)) {
if (areArraysOfNumbersEqual(keyIDs[j], elt.keyId)) {
return false;
}
}
Expand Down