mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Avoid infinite loop on corrupt stream recording (#96881)
* Avoid infinite loop on corrupt stream recording * Update tests
This commit is contained in:
parent
f2bd122fde
commit
3e58e1987c
@ -151,7 +151,7 @@ def find_moov(mp4_io: BufferedIOBase) -> int:
|
|||||||
while 1:
|
while 1:
|
||||||
mp4_io.seek(index)
|
mp4_io.seek(index)
|
||||||
box_header = mp4_io.read(8)
|
box_header = mp4_io.read(8)
|
||||||
if len(box_header) != 8:
|
if len(box_header) != 8 or box_header[0:4] == b"\x00\x00\x00\x00":
|
||||||
raise HomeAssistantError("moov atom not found")
|
raise HomeAssistantError("moov atom not found")
|
||||||
if box_header[4:8] == b"moov":
|
if box_header[4:8] == b"moov":
|
||||||
return index
|
return index
|
||||||
|
@ -245,7 +245,7 @@ class FakePyAvBuffer:
|
|||||||
# Forward to appropriate FakeStream
|
# Forward to appropriate FakeStream
|
||||||
packet.stream.mux(packet)
|
packet.stream.mux(packet)
|
||||||
# Make new init/part data available to the worker
|
# Make new init/part data available to the worker
|
||||||
self.memory_file.write(b"\x00\x00\x00\x00moov")
|
self.memory_file.write(b"\x00\x00\x00\x08moov")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Close the buffer."""
|
"""Close the buffer."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user