1
0
Fork 0
forked from len0rd/rockbox

make WavPack library check the extent of the block that it is parsing so that it cannot run into the next block; also enhance the metadata code to handle the case of files with non-audio blocks at the beginning (which can happen if the source WAV file has lots of RIFF data)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28736 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Bryant 2010-12-05 19:25:32 +00:00
parent 271441eb9d
commit 516693fcc9
4 changed files with 81 additions and 49 deletions

View file

@ -69,6 +69,8 @@ WavpackContext *WavpackOpenFileInput (read_stream infile, char *error)
return NULL;
}
wps->block_bytes_left = wps->wphdr.ckSize - 24;
if ((wps->wphdr.flags & UNKNOWN_FLAGS) || wps->wphdr.version < MIN_STREAM_VERS ||
wps->wphdr.version > MAX_STREAM_VERS) {
strcpy_loc (error, "invalid WavPack file!");
@ -171,6 +173,8 @@ uint32_t WavpackUnpackSamples (WavpackContext *wpc, int32_t *buffer, uint32_t sa
if (bcount == (uint32_t) -1)
break;
wps->block_bytes_left = wps->wphdr.ckSize - 24;
if (wps->wphdr.version < MIN_STREAM_VERS || wps->wphdr.version > MAX_STREAM_VERS) {
strcpy_loc (wpc->error_message, "invalid WavPack file!");
break;