@ahmedrowaihi/mediabunny 1.65.2-beta.691 → 1.65.2-beta.693

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8432,6 +8432,9 @@ var Mediabunny = (() => {
8432
8432
  }
8433
8433
  const contentStartPos = slice.filePos;
8434
8434
  const boxEndPos = startPos + boxInfo.totalSize;
8435
+ if (boxEndPos > slice.end) {
8436
+ return false;
8437
+ }
8435
8438
  switch (boxInfo.name) {
8436
8439
  case "mdia":
8437
8440
  case "minf":
@@ -8709,7 +8712,7 @@ var Mediabunny = (() => {
8709
8712
  for (let i = 0; i < entries; i++) {
8710
8713
  const sampleBoxStartPos = slice.filePos;
8711
8714
  const sampleBoxInfo = readBoxHeader(slice);
8712
- if (!sampleBoxInfo) {
8715
+ if (!sampleBoxInfo || sampleBoxStartPos + sampleBoxInfo.totalSize > slice.end) {
8713
8716
  break;
8714
8717
  }
8715
8718
  track.internalCodecId = sampleBoxInfo.name;
@@ -34360,6 +34363,10 @@ var Mediabunny = (() => {
34360
34363
  }
34361
34364
  const promise = (async () => {
34362
34365
  const sourceRef = await this._getSourceUncached(request);
34366
+ if (this._disposed) {
34367
+ sourceRef.free();
34368
+ throw new InputDisposedError();
34369
+ }
34363
34370
  const MAX_SOURCE_CACHE_SIZE = 4;
34364
34371
  const count = arrayCount(
34365
34372
  this._sourceCache,
@@ -63685,8 +63692,11 @@ ${baseUrl}${p.getFileName()}`;
63685
63692
  }
63686
63693
  const handlerType = String.fromCharCode(...hdlr2.data.subarray(8, 12));
63687
63694
  const tkhd2 = findBox([trak2], "tkhd");
63695
+ const sampleEntry = findBox([trak2], "stsd")?.children?.[0];
63696
+ if (tkhd2?.data === void 0 || sampleEntry === void 0) {
63697
+ continue;
63698
+ }
63688
63699
  const trackId = readU323(tkhd2.data, tkhd2.data[0] === 1 ? 20 : 12);
63689
- const sampleEntry = findBox([trak2], "stsd").children[0];
63690
63700
  const defaultSampleDuration = trexSampleDuration(moov2, trackId);
63691
63701
  if (handlerType === "vide") {
63692
63702
  tracks.push({