Skip to content
Permalink
Browse files Browse the repository at this point in the history
issue #67: make sure sample rate is specified and non-zero in DFF files
  • Loading branch information
dbry committed Mar 6, 2019
1 parent 33a0025 commit bc6cba3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/dsdiff.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit bc6cba3

Please sign in to comment.