Skip to content
Permalink
Browse files Browse the repository at this point in the history
issue #28, do not overwrite heap on corrupt DSDIFF file
  • Loading branch information
dbry committed Feb 11, 2018
1 parent d5bf76b commit 36a24c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cli/dsdiff.c
Expand Up @@ -153,7 +153,17 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
error_line ("dsdiff file version = 0x%08x", version);
}
else if (!strncmp (dff_chunk_header.ckID, "PROP", 4)) {
char *prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);
char *prop_chunk;

if (dff_chunk_header.ckDataSize < 4 || dff_chunk_header.ckDataSize > 1024) {
error_line ("%s is not a valid .DFF file!", infilename);
return WAVPACK_SOFT_ERROR;
}

if (debug_logging_mode)
error_line ("got PROP chunk of %d bytes total", (int) dff_chunk_header.ckDataSize);

prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);

if (!DoReadFile (infile, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize, &bcount) ||
bcount != dff_chunk_header.ckDataSize) {
Expand Down

0 comments on commit 36a24c7

Please sign in to comment.