refactor: cap waveform decode length + guard frombuffer + tighten test

This commit is contained in:
2026-07-02 15:00:34 +02:00
parent 12eaa944a7
commit 7501c4729b
3 changed files with 11 additions and 2 deletions
+3 -1
View File
@@ -32,4 +32,6 @@ def load_region_samples(path: str, start: float, duration: float,
return np.zeros(0, dtype="float32")
if proc.returncode != 0 or not proc.stdout:
return np.zeros(0, dtype="float32")
return np.frombuffer(proc.stdout, dtype="float32")
buf = proc.stdout
buf = buf[: len(buf) - (len(buf) % 4)]
return np.frombuffer(buf, dtype="float32")