From f93d81b15e6e98f3f07af868a687d82a894d8f18 Mon Sep 17 00:00:00 2001
From: Gregory Maxwell <greg@xiph.org>
Date: Sun, 7 Aug 2011 00:57:31 -0400
Subject: [PATCH] Correct allocation tilt estimation in the CELT encoder for
 stereo. Remove a redundant negative length check in celt_decode.

---
 libcelt/celt.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libcelt/celt.c b/libcelt/celt.c
index a0c83f22c..ad4ef6013 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -839,7 +839,7 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X,
       {
          diff += bandLogE[i+c*m->nbEBands]*(opus_int32)(2+2*i-m->nbEBands);
       }
-   } while (++c<0);
+   } while (++c<C);
    diff /= C*(end-1);
    /*printf("%f\n", diff);*/
    if (diff > QCONST16(2.f, DB_SHIFT))
@@ -2364,10 +2364,6 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
       RESTORE_STACK;
       return frame_size/st->downsample;
    }
-   if (len<0) {
-     RESTORE_STACK;
-     return CELT_BAD_ARG;
-   }
 
    if (dec == NULL)
    {
-- 
GitLab