edid-decode: new package
[buildroot-gz.git] / package / vorbis-tools / 0001-oggenc-Fix-large-alloca-on-bad-AIFF-input.patch
blob6df67869e59caf073ab8d5bf8d073031ca4841e6
1 Fix CVE-2015-6749 - invalid AIFF file causes alloca() buffer overflow.
2 See https://trac.xiph.org/ticket/2212
3 Status: upstream
5 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
7 diff --git a/oggenc/audio.c b/oggenc/audio.c
8 index 477da8c..4921fb9 100644
9 --- a/oggenc/audio.c
10 +++ b/oggenc/audio.c
11 @@ -245,8 +245,8 @@ static int aiff_permute_matrix[6][6] =
12 int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
14 int aifc; /* AIFC or AIFF? */
15 - unsigned int len;
16 - unsigned char *buffer;
17 + unsigned int len, readlen;
18 + unsigned char buffer[22];
19 unsigned char buf2[8];
20 aiff_fmt format;
21 aifffile *aiff = malloc(sizeof(aifffile));
22 @@ -269,9 +269,9 @@ int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
23 return 0; /* Weird common chunk */
26 - buffer = alloca(len);
28 - if(fread(buffer,1,len,in) < len)
29 + readlen = len < sizeof(buffer) ? len : sizeof(buffer);
30 + if(fread(buffer,1,readlen,in) < readlen ||
31 + (len > readlen && !seek_forward(in, len-readlen)))
33 fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n"));
34 return 0;
35 --
36 2.5.0