Skip to content

Commit

Permalink
issue #110: sanitize DSD file types for invalid lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
dbry committed Nov 23, 2021
1 parent a0ba858 commit 773f9d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli/dsdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
}

total_samples = dff_chunk_header.ckDataSize / config->num_channels;

if (total_samples <= 0 || total_samples > MAX_WAVPACK_SAMPLES) {
error_line ("%s is not a valid .DFF file!", infilename);
return WAVPACK_SOFT_ERROR;
}

break;
}
else { // just copy unknown chunks to output file
Expand Down
1 change: 1 addition & 0 deletions cli/dsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ int ParseDsfHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackC

if (format_chunk.ckSize != sizeof (DSFFormatChunk) || format_chunk.formatVersion != 1 ||
format_chunk.formatID != 0 || format_chunk.blockSize != DSF_BLOCKSIZE || format_chunk.reserved ||
format_chunk.sampleCount <= 0 || format_chunk.sampleCount > MAX_WAVPACK_SAMPLES * 8 ||
(format_chunk.bitsPerSample != 1 && format_chunk.bitsPerSample != 8) ||
format_chunk.numChannels < 1 || format_chunk.numChannels > 6 ||
format_chunk.chanType < 1 || format_chunk.chanType > NUM_CHAN_TYPES) {
Expand Down

2 comments on commit 773f9d0

@kloczek
Copy link

@kloczek kloczek commented on 773f9d0 Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is CVE.
Is it possible to make new release with that commit? 🤔

@dbry
Copy link
Owner Author

@dbry dbry commented on 773f9d0 Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks, it is time to make a new release. There have been several fixes that are worth getting in, and I have a couple fixes unrelated to security that I'd also like to get in.

Please sign in to comment.