]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/wavpack/0003-issue-28-do-not-overwrite-heap-on-corrupt-DSDIFF-fil.patch
wavpack: add upstream security fixes
[coffee/buildroot.git] / package / wavpack / 0003-issue-28-do-not-overwrite-heap-on-corrupt-DSDIFF-fil.patch
1 From 36a24c7881427d2e1e4dc1cef58f19eee0d13aec Mon Sep 17 00:00:00 2001
2 From: David Bryant <david@wavpack.com>
3 Date: Sat, 10 Feb 2018 16:01:39 -0800
4 Subject: [PATCH] issue #28, do not overwrite heap on corrupt DSDIFF file
5
6 Fixes CVE-2018-7253
7
8 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
9 ---
10  cli/dsdiff.c | 12 +++++++++++-
11  1 file changed, 11 insertions(+), 1 deletion(-)
12
13 diff --git a/cli/dsdiff.c b/cli/dsdiff.c
14 index 410dc1c..c016df9 100644
15 --- a/cli/dsdiff.c
16 +++ b/cli/dsdiff.c
17 @@ -153,7 +153,17 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
18                  error_line ("dsdiff file version = 0x%08x", version);
19          }
20          else if (!strncmp (dff_chunk_header.ckID, "PROP", 4)) {
21 -            char *prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);
22 +            char *prop_chunk;
23 +
24 +            if (dff_chunk_header.ckDataSize < 4 || dff_chunk_header.ckDataSize > 1024) {
25 +                error_line ("%s is not a valid .DFF file!", infilename);
26 +                return WAVPACK_SOFT_ERROR;
27 +            }
28 +
29 +            if (debug_logging_mode)
30 +                error_line ("got PROP chunk of %d bytes total", (int) dff_chunk_header.ckDataSize);
31 +
32 +            prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);
33  
34              if (!DoReadFile (infile, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize, &bcount) ||
35                  bcount != dff_chunk_header.ckDataSize) {
36 -- 
37 2.11.0
38