summaryrefslogtreecommitdiffstats
path: root/sbc
diff options
context:
space:
mode:
Diffstat (limited to 'sbc')
-rw-r--r--sbc/sbc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbc/sbc.c b/sbc/sbc.c
index ca683e86..240a5d24 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -28,7 +28,6 @@
use a log2 table for byte integer scale factors calculation (sum log2 results for high and low bytes)
fill bitpool by 16 bits instead of one at a time in bits allocation/bitpool generation
port to the dsp
- don't consume more bytes than passed into the encoder
*/
@@ -1390,6 +1389,10 @@ int sbc_encode(sbc_t *sbc, void *data, int count)
priv->init = 1;
}
+ /* input must be large enough to encode a complete frame */
+ if (count < priv->frame.subbands * priv->frame.blocks * sbc->channels * 2)
+ return 0;
+
ptr = data;
for (i = 0; i < priv->frame.subbands * priv->frame.blocks; i++) {