From a16d4d7f6a210030b5ce283d6d80083569799c77 Mon Sep 17 00:00:00 2001 From: Ulrich Eckhardt Date: Wed, 17 Jul 2024 22:10:09 +0200 Subject: [PATCH] UUIDBox: Fix parsing This stored all input data as payload. However, the first 16 bytes are a UUID and only the rest is actual payload. --- src/jumbf/UUIDBox.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jumbf/UUIDBox.ts b/src/jumbf/UUIDBox.ts index 62006fc3..1d38b582 100644 --- a/src/jumbf/UUIDBox.ts +++ b/src/jumbf/UUIDBox.ts @@ -11,7 +11,10 @@ export class UUIDBox extends Box { } public parse(buf: Uint8Array) { - this.content = buf; + if (buf.length < 16) throw new Error('UUIDBox: Data too short'); + + this.uuid = buf.subarray(0, 16); + this.content = buf.subarray(16); } public toString(prefix?: string | undefined): string {