mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-29 20:45:11 +00:00
fix(drm): raise ValueError when a file ends inside a box largesize in read_top_boxes
This commit is contained in:
@@ -4,7 +4,7 @@ from uuid import UUID
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core.drm.verify import PIFF_TENC, PIFF_TFXD, KidMap, kid_windows, pick_windows
|
||||
from unshackle.core.drm.verify import PIFF_TENC, PIFF_TFXD, KidMap, kid_windows, pick_windows, read_top_boxes
|
||||
|
||||
A, B, C = UUID(int=0xA), UUID(int=0xB), UUID(int=0xC)
|
||||
|
||||
@@ -192,6 +192,13 @@ def test_oversized_box(tmp_path: Path) -> None:
|
||||
assert kid_windows(path) is None
|
||||
|
||||
|
||||
def test_box_cut_inside_its_largesize(tmp_path: Path) -> None:
|
||||
path = tmp_path / "cut.mp4"
|
||||
path.write_bytes(struct.pack(">I4s", 1, b"moof") + bytes(4))
|
||||
with path.open("rb") as f, pytest.raises(ValueError):
|
||||
list(read_top_boxes(f))
|
||||
|
||||
|
||||
def test_not_a_fragmented_mp4(tmp_path: Path) -> None:
|
||||
path = tmp_path / "video.ts"
|
||||
path.write_bytes(b"\x47" * 188 * 4)
|
||||
|
||||
Reference in New Issue
Block a user