aboutsummaryrefslogtreecommitdiff
path: root/celt/modes.c
diff options
context:
space:
mode:
Diffstat (limited to 'celt/modes.c')
-rw-r--r--celt/modes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/celt/modes.c b/celt/modes.c
index ed204d7..42e68e1 100644
--- a/celt/modes.c
+++ b/celt/modes.c
@@ -345,6 +345,14 @@ CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error)
mode->eBands = compute_ebands(Fs, mode->shortMdctSize, res, &mode->nbEBands);
if (mode->eBands==NULL)
goto failure;
+#if !defined(SMALL_FOOTPRINT)
+ /* Make sure we don't allocate a band larger than our PVQ table.
+ 208 should be enough, but let's be paranoid. */
+ if ((mode->eBands[mode->nbEBands] - mode->eBands[mode->nbEBands-1])<<LM >
+ 208) {
+ goto failure;
+ }
+#endif
mode->effEBands = mode->nbEBands;
while (mode->eBands[mode->effEBands] > mode->shortMdctSize)