summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/libsndfile
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/libsndfile')
-rw-r--r--meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-14245-14246.patch121
-rw-r--r--meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb1
2 files changed, 122 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-14245-14246.patch b/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-14245-14246.patch
new file mode 100644
index 0000000000..a17ec21f98
--- /dev/null
+++ b/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-14245-14246.patch
@@ -0,0 +1,121 @@
1From 2d54514a4f6437b67829717c05472d2e3300a258 Mon Sep 17 00:00:00 2001
2From: Fabian Greffrath <fabian@greffrath.com>
3Date: Wed, 27 Sep 2017 14:46:17 +0200
4Subject: [PATCH] sfe_copy_data_fp: check value of "max" variable for being
5 normal
6
7and check elements of the data[] array for being finite.
8
9Both checks use functions provided by the <math.h> header as declared
10by the C99 standard.
11
12Fixes #317
13CVE: CVE-2017-14245
14CVE: CVE-2017-14246
15
16Upstream-Status: Backport [https://github.com/fabiangreffrath/libsndfile/commit/2d54514a4f6437b67829717c05472d2e3300a258]
17
18Signed-off-by: Fabian Greffrath <fabian@greffrath.com>
19Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>
20---
21 programs/common.c | 20 ++++++++++++++++----
22 programs/common.h | 2 +-
23 programs/sndfile-convert.c | 6 +++++-
24 3 files changed, 22 insertions(+), 6 deletions(-)
25
26diff --git a/programs/common.c b/programs/common.c
27index a21e62c..a249a58 100644
28--- a/programs/common.c
29+++ b/programs/common.c
30@@ -36,6 +36,7 @@
31 #include <string.h>
32 #include <ctype.h>
33 #include <stdint.h>
34+#include <math.h>
35
36 #include <sndfile.h>
37
38@@ -45,7 +46,7 @@
39
40 #define MIN(x, y) ((x) < (y) ? (x) : (y))
41
42-void
43+int
44 sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize)
45 { static double data [BUFFER_LEN], max ;
46 int frames, readcount, k ;
47@@ -54,6 +55,8 @@ sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize
48 readcount = frames ;
49
50 sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
51+ if (!isnormal (max)) /* neither zero, subnormal, infinite, nor NaN */
52+ return 1 ;
53
54 if (!normalize && max < 1.0)
55 { while (readcount > 0)
56@@ -67,12 +70,16 @@ sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize
57 while (readcount > 0)
58 { readcount = sf_readf_double (infile, data, frames) ;
59 for (k = 0 ; k < readcount * channels ; k++)
60- data [k] /= max ;
61+ { data [k] /= max ;
62+
63+ if (!isfinite (data [k])) /* infinite or NaN */
64+ return 1;
65+ }
66 sf_writef_double (outfile, data, readcount) ;
67 } ;
68 } ;
69
70- return ;
71+ return 0 ;
72 } /* sfe_copy_data_fp */
73
74 void
75@@ -252,7 +259,12 @@ sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * in
76
77 /* If the input file is not the same as the output file, copy the data. */
78 if ((infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
79- sfe_copy_data_fp (outfile, infile, sfinfo.channels, SF_FALSE) ;
80+ { if (sfe_copy_data_fp (outfile, infile, sfinfo.channels, SF_FALSE) != 0)
81+ { printf ("Error : Not able to decode input file '%s'\n", filenames [0]) ;
82+ error_code = 1 ;
83+ goto cleanup_exit ;
84+ } ;
85+ }
86 else
87 sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
88 } ;
89diff --git a/programs/common.h b/programs/common.h
90index eda2d7d..986277e 100644
91--- a/programs/common.h
92+++ b/programs/common.h
93@@ -62,7 +62,7 @@ typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
94
95 void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
96
97-void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize) ;
98+int sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize) ;
99
100 void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
101
102diff --git a/programs/sndfile-convert.c b/programs/sndfile-convert.c
103index dff7f79..e6de593 100644
104--- a/programs/sndfile-convert.c
105+++ b/programs/sndfile-convert.c
106@@ -335,7 +335,11 @@ main (int argc, char * argv [])
107 || (outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT)
108 || (infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT)
109 || (infileminor == SF_FORMAT_VORBIS) || (outfileminor == SF_FORMAT_VORBIS))
110- sfe_copy_data_fp (outfile, infile, sfinfo.channels, normalize) ;
111+ { if (sfe_copy_data_fp (outfile, infile, sfinfo.channels, normalize) != 0)
112+ { printf ("Error : Not able to decode input file %s.\n", infilename) ;
113+ return 1 ;
114+ } ;
115+ }
116 else
117 sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
118
119--
1202.7.4
121
diff --git a/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb b/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
index 281ac82e39..c6f2a460b2 100644
--- a/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
+++ b/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
@@ -10,6 +10,7 @@ SRC_URI = "http://www.mega-nerd.com/libsndfile/files/libsndfile-${PV}.tar.gz \
10 file://CVE-2017-8361-8365.patch \ 10 file://CVE-2017-8361-8365.patch \
11 file://CVE-2017-8362.patch \ 11 file://CVE-2017-8362.patch \
12 file://CVE-2017-8363.patch \ 12 file://CVE-2017-8363.patch \
13 file://CVE-2017-14245-14246.patch \
13 " 14 "
14 15
15SRC_URI[md5sum] = "646b5f98ce89ac60cdb060fcd398247c" 16SRC_URI[md5sum] = "646b5f98ce89ac60cdb060fcd398247c"