gnu: python-babel: Update to 2.7.0.
[guix.git] / gnu / packages / patches / vorbis-tools-CVE-2014-9638+CVE-2014-9639.patch
blob6e389dd59e2a30cffd07809d42ea5ab4ba5508f0
1 From: Petter Reinholdtsen <pere@debian.org>
2 Date: Tue, 22 Sep 2015 15:14:06 +0200
3 Subject: oggenc: validate count of channels in the header (CVE-2014-9638 &
4 CVE-2014-9639)
6 Author: Kamil Dudka <kdudka@redhat.com>
7 Origin: http://lists.xiph.org/pipermail/vorbis-dev/2015-February/020423.html
8 Bug: https://trac.xiph.org/ticket/2136
9 Bug: https://trac.xiph.org/ticket/2137
10 Bug-Debian: https://bugs.debian.org/776086
11 Forwarded: not-needed
12 Reviewed-By: Petter Reinholdtsen <pere@hungry.com>
13 Last-Update: 2015-09-22
14 ---
15 oggenc/audio.c | 18 ++++++++++++++++--
16 1 file changed, 16 insertions(+), 2 deletions(-)
18 diff --git a/oggenc/audio.c b/oggenc/audio.c
19 index 05e42b3..1b3f179 100644
20 --- a/oggenc/audio.c
21 +++ b/oggenc/audio.c
22 @@ -13,6 +13,7 @@
23 #include <config.h>
24 #endif
26 +#include <limits.h>
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30 @@ -251,6 +252,7 @@ int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
31 aiff_fmt format;
32 aifffile *aiff = malloc(sizeof(aifffile));
33 int i;
34 + long channels;
36 if(buf[11]=='C')
37 aifc=1;
38 @@ -277,11 +279,16 @@ int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
39 return 0;
42 - format.channels = READ_U16_BE(buffer);
43 + format.channels = channels = READ_U16_BE(buffer);
44 format.totalframes = READ_U32_BE(buffer+2);
45 format.samplesize = READ_U16_BE(buffer+6);
46 format.rate = (int)read_IEEE80(buffer+8);
48 + if(channels <= 0L || SHRT_MAX < channels)
49 + {
50 + fprintf(stderr, _("Warning: Unsupported count of channels in AIFF header\n"));
51 + return 0;
52 + }
53 aiff->bigendian = 1;
55 if(aifc)
56 @@ -412,6 +419,7 @@ int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen)
57 wav_fmt format;
58 wavfile *wav = malloc(sizeof(wavfile));
59 int i;
60 + long channels;
62 /* Ok. At this point, we know we have a WAV file. Now we have to detect
63 * whether we support the subtype, and we have to find the actual data
64 @@ -449,12 +457,18 @@ int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen)
67 format.format = READ_U16_LE(buf);
68 - format.channels = READ_U16_LE(buf+2);
69 + format.channels = channels = READ_U16_LE(buf+2);
70 format.samplerate = READ_U32_LE(buf+4);
71 format.bytespersec = READ_U32_LE(buf+8);
72 format.align = READ_U16_LE(buf+12);
73 format.samplesize = READ_U16_LE(buf+14);
75 + if(channels <= 0L || SHRT_MAX < channels)
76 + {
77 + fprintf(stderr, _("Warning: Unsupported count of channels in WAV header\n"));
78 + return 0;
79 + }
81 if(format.format == -2) /* WAVE_FORMAT_EXTENSIBLE */
83 if(len<40)