diff --git a/libcelt/celt.c b/libcelt/celt.c index 09895bf7..5e8c8c8c 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -861,6 +861,9 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c for (i=0;imode->nbEBands;i++) offsets[i] = 0; + /* Dynamic allocation code */ + /* Make sure that dynamic allocation can't make us bust the budget */ + if (nbCompressedBytes > 30) { int t1, t2; if (LM <= 1) diff --git a/libcelt/rate.c b/libcelt/rate.c index 7ae5f59b..a760951f 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -190,7 +190,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int } codedBands++; /* Allocate the remaining bits */ - { + if (codedBands) { int left, perband; left = (total<