Problem
apps/scanner/fingerprint.py lines 227–250:
async for chunk in resp.aiter_bytes(chunk_size=65536):
handle.write(chunk)
The download has a 60-second timeout but no byte-count limit. A piracy server returning HTTP 200 with an infinite body will fill disk until the OS kills the process or the timeout fires. At 10 Mbps for 60 seconds that is ~75 MB per fingerprint job.
Also: subprocess.run for fpcalc and ffmpeg at lines 188–197 has no timeout= parameter — a maliciously crafted audio file or codec bug can hang a thread-pool slot indefinitely.
Fix
MAX_DOWNLOAD_BYTES = 50 * 1024 * 1024
total = 0
async for chunk in resp.aiter_bytes(chunk_size=65536):
total += len(chunk)
if total > MAX_DOWNLOAD_BYTES:
raise FingerprintError(f'download exceeded {MAX_DOWNLOAD_BYTES} bytes')
handle.write(chunk)
And for subprocess: subprocess.run(cmd, timeout=CLIP_SECONDS + 30, ...) with except subprocess.TimeoutExpired: raise FingerprintError('ffmpeg timed out').
Problem
apps/scanner/fingerprint.pylines 227–250:The download has a 60-second timeout but no byte-count limit. A piracy server returning HTTP 200 with an infinite body will fill disk until the OS kills the process or the timeout fires. At 10 Mbps for 60 seconds that is ~75 MB per fingerprint job.
Also:
subprocess.runforfpcalcandffmpegat lines 188–197 has notimeout=parameter — a maliciously crafted audio file or codec bug can hang a thread-pool slot indefinitely.Fix
And for subprocess:
subprocess.run(cmd, timeout=CLIP_SECONDS + 30, ...)withexcept subprocess.TimeoutExpired: raise FingerprintError('ffmpeg timed out').