37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
From bc6cba3f552c44565f7f1e66dc1580189addb2b4 Mon Sep 17 00:00:00 2001
|
|
From: David Bryant <david@wavpack.com>
|
|
Date: Tue, 5 Mar 2019 21:32:27 -0800
|
|
Subject: [PATCH] issue #67: make sure sample rate is specified and non-zero in
|
|
DFF files
|
|
|
|
---
|
|
cli/dsdiff.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/cli/dsdiff.c b/cli/dsdiff.c
|
|
index f357181..193adee 100644
|
|
--- a/cli/dsdiff.c
|
|
+++ b/cli/dsdiff.c
|
|
@@ -171,7 +171,7 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
|
|
if (!strncmp (prop_chunk, "SND ", 4)) {
|
|
char *cptr = prop_chunk + 4, *eptr = prop_chunk + dff_chunk_header.ckDataSize;
|
|
uint16_t numChannels, chansSpecified, chanMask = 0;
|
|
- uint32_t sampleRate;
|
|
+ uint32_t sampleRate = 0;
|
|
|
|
while (eptr - cptr >= sizeof (dff_chunk_header)) {
|
|
memcpy (&dff_chunk_header, cptr, sizeof (dff_chunk_header));
|
|
@@ -263,6 +263,12 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
|
|
free (prop_chunk);
|
|
}
|
|
else if (!strncmp (dff_chunk_header.ckID, "DSD ", 4)) {
|
|
+
|
|
+ if (!config->num_channels || !config->sample_rate) {
|
|
+ error_line ("%s is not a valid .DFF file!", infilename);
|
|
+ return WAVPACK_SOFT_ERROR;
|
|
+ }
|
|
+
|
|
total_samples = dff_chunk_header.ckDataSize / config->num_channels;
|
|
break;
|
|
}
|