[FFmpeg-cvslog] avcodec/lpc: copy levenson coeffs only when they have been computed

Michael Niedermayer git at videolan.org
Fri Jun 14 22:20:01 EEST 2024


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Sat May 11 20:50:44 2024 +0200| [4f5ae895ce9172691d3a2b3e6c3474820d617f7a] | committer: Michael Niedermayer

avcodec/lpc: copy levenson coeffs only when they have been computed

Fixes: CID1473514 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c2d897f3566fdf5c190583c6f5197ead5abec2ed)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/lpc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index c990cfc6c3..fc97ce3ae0 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -243,8 +243,10 @@ int ff_lpc_calc_coefs(LPCContext *s,
         double av_uninit(weight);
         memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
 
-        for(j=0; j<max_order; j++)
-            m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
+        /* Avoids initializing with an unused value when lpc_passes == 1 */
+        if (lpc_passes > 1)
+            for(j=0; j<max_order; j++)
+                m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
 
         for(; pass<lpc_passes; pass++){
             avpriv_init_lls(&m[pass&1], max_order);



More information about the ffmpeg-cvslog mailing list