* Fix a crash bug on some oddly-formed WAV files.

This commit is contained in:
Justin Maggard 2012-03-08 18:11:01 +00:00
parent 0a0be0d96c
commit 25c74a3962
2 changed files with 4 additions and 3 deletions

View File

@ -79,7 +79,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
/* now, walk through the chunks */ /* now, walk through the chunks */
current_offset = 12; current_offset = 12;
while(current_offset < psong->file_size) while(current_offset + 8 < psong->file_size)
{ {
len = 8; len = 8;
if(!(len = read(fd, hdr, len)) || (len != 8)) if(!(len = read(fd, hdr, len)) || (len != 8))
@ -145,7 +145,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
char **m; char **m;
len = GET_WAV_INT32(hdr + 4); len = GET_WAV_INT32(hdr + 4);
if(len > 65536) if(len > 65536 || len < 9)
goto next_block; goto next_block;
tags = malloc(len+1); tags = malloc(len+1);

View File

@ -2006,4 +2006,5 @@ error:
if( !newpid ) if( !newpid )
_exit(0); _exit(0);
#endif #endif
return;
} }