Reject oversized media before fully downloading it (#51896)

Signed-off-by: Clinton Thomas <1033162+KernelClint@users.noreply.github.com>
Co-authored-by: Lucas Bourtoule <35483370+dhalf@users.noreply.github.com>
This commit is contained in:
Clinton Thomas
2026-08-24 01:15:09 +00:00
committed by GitHub
co-authored by Lucas Bourtoule
parent 585bb07c70
commit 2ec6f0d71e
13 changed files with 718 additions and 24 deletions
+4
View File
@@ -79,6 +79,10 @@ class MediaIO(ABC, Generic[_T]):
merged.update(runtime_kwargs)
return merged
def get_max_bytes(self) -> int | None:
"""Return the maximum encoded payload size accepted by this media IO."""
return None
@abstractmethod
def load_bytes(self, data: bytes) -> _T:
raise NotImplementedError