summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-09-21 07:00:15 +0200
committerLynne <dev@lynne.ee>2022-09-21 07:09:36 +0200
commitcc367a9b8aa1e473bf60c5dc5e03431a7bbcd125 (patch)
tree6946c168ea694c9d77c274ad702a2bdb5382832e
parente601ec3c1991ee09ff45db3be4d894e5774f6f2b (diff)
lavc/lpc: do not explode when windowing a 1-length array
Divided by 0.
-rw-r--r--libavcodec/lpc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 3238ad5fc8..4885d5cb06 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -38,6 +38,11 @@ static void lpc_apply_welch_window_c(const int32_t *data, int len,
double w;
double c;
+ if (len == 1) {
+ w_data[0] = 0.0;
+ return;
+ }
+
n2 = (len >> 1);
c = 2.0 / (len - 1.0);