Skip to content

Commit 64e9007

Browse files
author
Justin Maggard
committed
* Fix a crash bug on some oddly-formed WAV files.
1 parent 02bc88b commit 64e9007

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tagutils/tagutils-wav.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
7979

8080
/* now, walk through the chunks */
8181
current_offset = 12;
82-
while(current_offset < psong->file_size)
82+
while(current_offset + 8 < psong->file_size)
8383
{
8484
len = 8;
8585
if(!(len = read(fd, hdr, len)) || (len != 8))
@@ -92,7 +92,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
9292
current_offset += 8;
9393
block_len = GET_WAV_INT32(hdr + 4);
9494

95-
//DEBUG DPRINTF(E_DEBUG,L_SCANNER,"Read block %02x%02x%02x%02x (%c%c%c%c) of "
95+
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Read block %02x%02x%02x%02x (%c%c%c%c) of "
9696
// "size 0x%08x\n",hdr[0],hdr[1],hdr[2],hdr[3],
9797
// isprint(hdr[0]) ? hdr[0] : '?',
9898
// isprint(hdr[1]) ? hdr[1] : '?',
@@ -145,7 +145,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
145145
char **m;
146146

147147
len = GET_WAV_INT32(hdr + 4);
148-
if(len > 65536)
148+
if(len > 65536 || len < 9)
149149
goto next_block;
150150

151151
tags = malloc(len+1);

upnphttp.c

+1
Original file line numberDiff line numberDiff line change
@@ -2006,4 +2006,5 @@ SendResp_dlnafile(struct upnphttp * h, char * object)
20062006
if( !newpid )
20072007
_exit(0);
20082008
#endif
2009+
return;
20092010
}

0 commit comments

Comments
 (0)