summaryrefslogtreecommitdiff
path: root/apps/codecs/libwavpack/wputils.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libwavpack/wputils.c')
-rw-r--r--apps/codecs/libwavpack/wputils.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/apps/codecs/libwavpack/wputils.c b/apps/codecs/libwavpack/wputils.c
index 7fabc7ab34..7a6cc44ad4 100644
--- a/apps/codecs/libwavpack/wputils.c
+++ b/apps/codecs/libwavpack/wputils.c
@@ -69,10 +69,9 @@ WavpackContext *WavpackOpenFileInput (read_stream infile, char *error)
69 return NULL; 69 return NULL;
70 } 70 }
71 71
72 if ((wps->wphdr.flags & UNKNOWN_FLAGS) || wps->wphdr.version < MIN_STREAM_VERS || 72 if ((wps->wphdr.flags & UNKNOWN_FLAGS) || wps->wphdr.version < 0x402 || wps->wphdr.version > 0x40f) {
73 wps->wphdr.version > MAX_STREAM_VERS) { 73 strcpy_loc (error, "invalid WavPack file!");
74 strcpy_loc (error, "invalid WavPack file!"); 74 return NULL;
75 return NULL;
76 } 75 }
77 76
78 if (wps->wphdr.block_samples && wps->wphdr.total_samples != (uint32_t) -1) 77 if (wps->wphdr.block_samples && wps->wphdr.total_samples != (uint32_t) -1)
@@ -171,7 +170,7 @@ uint32_t WavpackUnpackSamples (WavpackContext *wpc, int32_t *buffer, uint32_t sa
171 if (bcount == (uint32_t) -1) 170 if (bcount == (uint32_t) -1)
172 break; 171 break;
173 172
174 if (wps->wphdr.version < MIN_STREAM_VERS || wps->wphdr.version > MAX_STREAM_VERS) { 173 if (wps->wphdr.version < 0x402 || wps->wphdr.version > 0x40f) {
175 strcpy_loc (wpc->error_message, "invalid WavPack file!"); 174 strcpy_loc (wpc->error_message, "invalid WavPack file!");
176 break; 175 break;
177 } 176 }
@@ -342,8 +341,7 @@ static uint32_t read_next_header (read_stream infile, WavpackHeader *wphdr)
342 sp = buffer; 341 sp = buffer;
343 342
344 if (*sp++ == 'w' && *sp == 'v' && *++sp == 'p' && *++sp == 'k' && 343 if (*sp++ == 'w' && *sp == 'v' && *++sp == 'p' && *++sp == 'k' &&
345 !(*++sp & 1) && sp [2] < 16 && !sp [3] && sp [5] == 4 && 344 !(*++sp & 1) && sp [2] < 16 && !sp [3] && sp [5] == 4 && sp [4] >= 2 && sp [4] <= 0xf) {
346 sp [4] >= (MIN_STREAM_VERS & 0xff) && sp [4] <= (MAX_STREAM_VERS & 0xff)) {
347 memcpy (wphdr, buffer, sizeof (*wphdr)); 345 memcpy (wphdr, buffer, sizeof (*wphdr));
348 little_endian_to_native (wphdr, WavpackHeaderFormat); 346 little_endian_to_native (wphdr, WavpackHeaderFormat);
349 return bytes_skipped; 347 return bytes_skipped;
@@ -454,7 +452,7 @@ int WavpackSetConfiguration (WavpackContext *wpc, WavpackConfig *config, uint32_
454 memcpy (wps->wphdr.ckID, "wvpk", 4); 452 memcpy (wps->wphdr.ckID, "wvpk", 4);
455 wps->wphdr.ckSize = sizeof (WavpackHeader) - 8; 453 wps->wphdr.ckSize = sizeof (WavpackHeader) - 8;
456 wps->wphdr.total_samples = wpc->total_samples; 454 wps->wphdr.total_samples = wpc->total_samples;
457 wps->wphdr.version = CUR_STREAM_VERS; 455 wps->wphdr.version = 0x403;
458 wps->wphdr.flags = flags; 456 wps->wphdr.flags = flags;
459 457
460 pack_init (wpc); 458 pack_init (wpc);