diff options
author | Justin Maggard <jmaggard@users.sourceforce.net> | 2012-03-14 12:38:59 +0400 |
---|---|---|
committer | Justin Maggard <jmaggard@users.sourceforce.net> | 2012-03-14 12:38:59 +0400 |
commit | e4a71022c5a85ad29aa4d472d40551dd6245fe65 (patch) | |
tree | b5bd177a34ace6f807075ca4126151905083db70 | |
parent | 64e900704c89341ba55e7718d8a3ade37e46339e (diff) |
* Handle some (apparently) common WAV file malformations.
-rw-r--r-- | tagutils/tagutils-wav.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tagutils/tagutils-wav.c b/tagutils/tagutils-wav.c index 7f9b293..e9f6c20 100644 --- a/tagutils/tagutils-wav.c +++ b/tagutils/tagutils-wav.c @@ -21,13 +21,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define GET_WAV_INT32(p) ((((uint32_t)((p)[3])) << 24) | \ - (((uint32_t)((p)[2])) << 16) | \ - (((uint32_t)((p)[1])) << 8) | \ - (((uint32_t)((p)[0])))) +#define GET_WAV_INT32(p) ((((uint8_t)((p)[3])) << 24) | \ + (((uint8_t)((p)[2])) << 16) | \ + (((uint8_t)((p)[1])) << 8) | \ + (((uint8_t)((p)[0])))) -#define GET_WAV_INT16(p) ((((uint32_t)((p)[1])) << 8) | \ - (((uint32_t)((p)[0])))) +#define GET_WAV_INT16(p) ((((uint8_t)((p)[1])) << 8) | \ + (((uint8_t)((p)[0])))) static int _get_wavtags(char *filename, struct song_metadata *psong) @@ -141,7 +141,7 @@ _get_wavtags(char *filename, struct song_metadata *psong) char *tags; char *p; int off; - int taglen; + uint32_t taglen; char **m; len = GET_WAV_INT32(hdr + 4); @@ -203,6 +203,11 @@ _get_wavtags(char *filename, struct song_metadata *psong) p += taglen + 8; off += taglen + 8; + /* Handle some common WAV file malformations */ + while (*p == '\0') { + p++; + off++; + } } free(tags); } |