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.tar.gz
rockbox-7155be6ca49ee71f565c8d5e196e189540edf2c8.zip
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 3303bc4d7d..b31e5f605a 100644
--- a/apps/codecs/libmusepack/streaminfo.c
+++ b/apps/codecs/libmusepack/streaminfo.c
@@ -101,8 +101,8 @@ mpc_get_encoder_string(mpc_streaminfo* si)
101static mpc_status check_streaminfo(mpc_streaminfo * si) 101static mpc_status check_streaminfo(mpc_streaminfo * si)
102{ 102{
103 if (si->max_band == 0 || si->max_band >= 32 103 if (si->max_band == 0 || si->max_band >= 32
104 || si->channels > 2) 104 || si->channels > 2 || si->channels == 0 || si->sample_freq == 0)
105 return MPC_STATUS_FILE; 105 return MPC_STATUS_FAIL;
106 return MPC_STATUS_OK; 106 return MPC_STATUS_OK;
107} 107}
108 108
@@ -160,6 +160,7 @@ streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r)
160*/ 160*/
161 161
162 if (last_frame_samples == 0) last_frame_samples = MPC_FRAME_LENGTH; 162 if (last_frame_samples == 0) last_frame_samples = MPC_FRAME_LENGTH;
163 else if (last_frame_samples > MPC_FRAME_LENGTH) return MPC_STATUS_FAIL;
163 si->samples = (mpc_int64_t) frames * MPC_FRAME_LENGTH; 164 si->samples = (mpc_int64_t) frames * MPC_FRAME_LENGTH;
164 if (si->is_true_gapless) 165 if (si->is_true_gapless)
165 si->samples -= (MPC_FRAME_LENGTH - last_frame_samples); 166 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,
196 197
197 CRC = (mpc_bits_read(&r, 16) << 16) | mpc_bits_read(&r, 16); 198 CRC = (mpc_bits_read(&r, 16) << 16) | mpc_bits_read(&r, 16);
198 if (CRC != mpc_crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4)) 199 if (CRC != mpc_crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4))
199 return MPC_STATUS_FILE; 200 return MPC_STATUS_FAIL;
200 201
201 si->stream_version = mpc_bits_read(&r, 8); 202 si->stream_version = mpc_bits_read(&r, 8);
202 if (si->stream_version != 8) 203 if (si->stream_version != 8)
203 return MPC_STATUS_INVALIDSV; 204 return MPC_STATUS_FAIL;
204 205
205 mpc_bits_get_size(&r, &si->samples); 206 mpc_bits_get_size(&r, &si->samples);
206 mpc_bits_get_size(&r, &si->beg_silence); 207 mpc_bits_get_size(&r, &si->beg_silence);