diff options
| author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-01-31 11:43:42 +0000 |
|---|---|---|
| committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-01-31 11:43:42 +0000 |
| commit | db4d7a313e10d085218a95f9176b12287a300d7c (patch) | |
| tree | 755ba6a2ae831cee6652ff8e922de1b8bf492a3c | |
| parent | 4c96bb54c60e10b190f2421a3bcb69a96381fce9 (diff) | |
| download | rockbox-db4d7a313e10d085218a95f9176b12287a300d7c.zip rockbox-db4d7a313e10d085218a95f9176b12287a300d7c.tar.gz rockbox-db4d7a313e10d085218a95f9176b12287a300d7c.tar.bz2 rockbox-db4d7a313e10d085218a95f9176b12287a300d7c.tar.xz | |
1st part of fix for FS#10637. Correction of mpc header parsing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24408 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/codecs/libmusepack/streaminfo.c | 12 | ||||
| -rw-r--r-- | apps/metadata/mpc.c | 8 |
2 files changed, 12 insertions, 8 deletions
diff --git a/apps/codecs/libmusepack/streaminfo.c b/apps/codecs/libmusepack/streaminfo.c index d9c925d..3edf50a 100644 --- a/apps/codecs/libmusepack/streaminfo.c +++ b/apps/codecs/libmusepack/streaminfo.c @@ -223,15 +223,17 @@ mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r) #endif si->stream_version = HeaderData[0] >> 24; - // stream version 8 - if ((si->stream_version & 15) >= 8) { - return ERROR_CODE_INVALIDSV; - } // stream version 7 - else if ((si->stream_version & 15) == 7) { + if ((si->stream_version & 15) == 7) { Error = streaminfo_read_header_sv7(si, HeaderData); if (Error != ERROR_CODE_OK) return Error; + } else { + // only sv7 allowed with "MP+" signature + return ERROR_CODE_INVALIDSV; } + } else if (memcmp(HeaderData, "MPCK", 4) == 0) { + // stream version 8 uses "MPCK" signature + return ERROR_CODE_INVALIDSV; } else { #ifdef MPC_SUPPORT_SV456 #ifndef MPC_LITTLE_ENDIAN diff --git a/apps/metadata/mpc.c b/apps/metadata/mpc.c index e20ac3e..3f8907a 100644 --- a/apps/metadata/mpc.c +++ b/apps/metadata/mpc.c @@ -66,9 +66,7 @@ bool get_musepack_metadata(int fd, struct mp3entry *id3) header[0] = letoh32(header[0]); streamversion = (header[0] >> 24) & 15; - if (streamversion >= 8) { - return false; /* SV8 or higher don't exist yet, so no support */ - } else if (streamversion == 7) { + if (streamversion == 7) { unsigned int gapless = (header[5] >> 31) & 0x0001; unsigned int last_frame_samples = (header[5] >> 20) & 0x07ff; unsigned int bufused = 0; @@ -82,7 +80,11 @@ bool get_musepack_metadata(int fd, struct mp3entry *id3) bufused = set_replaygain(id3, false, header[3], bufused); bufused = set_replaygain(id3, true, header[4], bufused); + } else { + return false; /* only SV7 is allowed within a "MP+" signature */ } + } else if (!memcmp(header, "MPCK", 4)) { /* Compare to sig "MPCK" */ + return false; /* SV8 is not supported yet */ } else { return false; /* SV4-6 is not supported anymore */ } |