summaryrefslogtreecommitdiff
path: root/apps/codecs/libmusepack/streaminfo.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-08-02 19:08:29 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-08-02 19:08:29 +0000
commit7155be6ca49ee71f565c8d5e196e189540edf2c8 (patch)
tree79ee549649559ea310f452631fe1d9132c5f0e94 /apps/codecs/libmusepack/streaminfo.c
parent7bbd7daaf77aa78a1ed2fc7338841f1653d20530 (diff)
downloadrockbox-7155be6ca49ee71f565c8d5e196e189540edf2c8.zip
rockbox-7155be6ca49ee71f565c8d5e196e189540edf2c8.tar.gz
rockbox-7155be6ca49ee71f565c8d5e196e189540edf2c8.tar.bz2
rockbox-7155be6ca49ee71f565c8d5e196e189540edf2c8.tar.xz
Sync rockbox to r475 of musepack's svn.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30240 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libmusepack/streaminfo.c')
-rw-r--r--apps/codecs/libmusepack/streaminfo.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/codecs/libmusepack/streaminfo.c b/apps/codecs/libmusepack/streaminfo.c
index 3303bc4..b31e5f6 100644
--- a/apps/codecs/libmusepack/streaminfo.c
+++ b/apps/codecs/libmusepack/streaminfo.c
@@ -101,8 +101,8 @@ mpc_get_encoder_string(mpc_streaminfo* si)
static mpc_status check_streaminfo(mpc_streaminfo * si)
{
if (si->max_band == 0 || si->max_band >= 32
- || si->channels > 2)
- return MPC_STATUS_FILE;
+ || si->channels > 2 || si->channels == 0 || si->sample_freq == 0)
+ return MPC_STATUS_FAIL;
return MPC_STATUS_OK;
}
@@ -160,6 +160,7 @@ streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r)
*/
if (last_frame_samples == 0) last_frame_samples = MPC_FRAME_LENGTH;
+ else if (last_frame_samples > MPC_FRAME_LENGTH) return MPC_STATUS_FAIL;
si->samples = (mpc_int64_t) frames * MPC_FRAME_LENGTH;
if (si->is_true_gapless)
si->samples -= (MPC_FRAME_LENGTH - last_frame_samples);
@@ -196,11 +197,11 @@ streaminfo_read_header_sv8(mpc_streaminfo* si, const mpc_bits_reader * r_in,
CRC = (mpc_bits_read(&r, 16) << 16) | mpc_bits_read(&r, 16);
if (CRC != mpc_crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4))
- return MPC_STATUS_FILE;
+ return MPC_STATUS_FAIL;
si->stream_version = mpc_bits_read(&r, 8);
if (si->stream_version != 8)
- return MPC_STATUS_INVALIDSV;
+ return MPC_STATUS_FAIL;
mpc_bits_get_size(&r, &si->samples);
mpc_bits_get_size(&r, &si->beg_silence);