From 281c8b7e9988f4ffd077b16110c1ad2d3bdebf84 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> Date: Tue, 22 Jun 2010 21:26:16 -0400 Subject: [PATCH] Preventing ridiculous bit depths > 16 bit/sample --- libcelt/bands.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcelt/bands.c b/libcelt/bands.c index 4334e7df4..41b713b78 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -895,6 +895,7 @@ void quant_all_bands(int encode, const CELTMode *m, int start, celt_norm *_X, ce int spread; celt_norm *lowband; int update_lowband = 1; + int C = _Y != NULL ? 2 : 1; SAVE_STACK; M = 1<<LM; @@ -935,6 +936,9 @@ void quant_all_bands(int encode, const CELTMode *m, int start, celt_norm *_X, ce b = IMIN(remaining_bits+1,pulses[i]+curr_balance); if (b<0) b = 0; + /* Prevents ridiculous bit depths */ + if (b > C*16*N<<BITRES) + b = C*16*N<<BITRES; if (M*eBands[i]-N >= M*eBands[start]) { -- GitLab