From cc367a9b8aa1e473bf60c5dc5e03431a7bbcd125 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 21 Sep 2022 07:00:15 +0200 Subject: [PATCH] lavc/lpc: do not explode when windowing a 1-length array Divided by 0. --- libavcodec/lpc.c | 5 +++++ 1 file changed, 5 insertions(+) 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);