Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforce.net>2012-03-14 12:38:59 +0400
committerJustin Maggard <jmaggard@users.sourceforce.net>2012-03-14 12:38:59 +0400
commite4a71022c5a85ad29aa4d472d40551dd6245fe65 (patch)
treeb5bd177a34ace6f807075ca4126151905083db70
parent64e900704c89341ba55e7718d8a3ade37e46339e (diff)
* Handle some (apparently) common WAV file malformations.
-rw-r--r--tagutils/tagutils-wav.c19
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);
}