diff options
author | Brad Midgley <bmidgley@xmission.com> | 2007-08-26 01:05:25 +0000 |
---|---|---|
committer | Brad Midgley <bmidgley@xmission.com> | 2007-08-26 01:05:25 +0000 |
commit | c82412ad9e399b9b6391ef73c24f36ff83983e9d (patch) | |
tree | 72c021ecd5f8f504b4ea70980ccc210591c26caa /sbc/sbc.c | |
parent | d542fb37a81d1d96604d41b36a6d6b11087ba2da (diff) |
indicate 0 bytes consumed in encoder if input is too short.
caller is responsible for filling the end of the input if it really wants the frame encoded (ie with silence
at the end)
Diffstat (limited to 'sbc/sbc.c')
-rw-r--r-- | sbc/sbc.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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++) { |