1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
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
@@ -181,7 +181,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 = 0, 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));
@@ -280,7 +280,7 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
}
else if (!strncmp (dff_chunk_header.ckID, "DSD ", 4)) {
- if (!config->num_channels) {
+ if (!config->num_channels || !config->sample_rate) {
error_line ("%s is not a valid .DFF file!", infilename);
return WAVPACK_SOFT_ERROR;
}
|