[FFmpeg-cvslog] lavc/lpc: do not explode when windowing a 1-length array

Lynne git at videolan.org
Wed Sep 21 08:12:50 EEST 2022


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Wed Sep 21 07:00:15 2022 +0200| [cc367a9b8aa1e473bf60c5dc5e03431a7bbcd125] | committer: Lynne

lavc/lpc: do not explode when windowing a 1-length array

Divided by 0.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc367a9b8aa1e473bf60c5dc5e03431a7bbcd125
---

 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);
 



More information about the ffmpeg-cvslog mailing list