Commit c1059cd1 authored by Petter Reinholdtsen's avatar Petter Reinholdtsen Committed by Thomas Daede

oggenc: Fix large alloca on bad AIFF input (CVE-2015-6749).

Author: Mark Harris <mark.hsj@gmail.com>
Origin: https://trac.xiph.org/attachment/ticket/2212/0001-oggenc-Fix-large-alloca-on-bad-AIFF-input.patch
Bug-Debian: https://bugs.debian.org/797461
Forwarded: https://trac.xiph.org/ticket/2212Reviewed-By: Petter Reinholdtsen's avatarPetter Reinholdtsen <pere@hungry.com>
Last-Update: 2015-09-22
parent 08ccd9ec
......@@ -245,8 +245,8 @@ static int aiff_permute_matrix[6][6] =
int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
{
int aifc; /* AIFC or AIFF? */
unsigned int len;
unsigned char *buffer;
unsigned int len, readlen;
unsigned char buffer[22];
unsigned char buf2[8];
aiff_fmt format;
aifffile *aiff = malloc(sizeof(aifffile));
......@@ -269,9 +269,9 @@ int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
return 0; /* Weird common chunk */
}
buffer = alloca(len);
if(fread(buffer,1,len,in) < len)
readlen = len < sizeof(buffer) ? len : sizeof(buffer);
if(fread(buffer,1,readlen,in) < readlen ||
(len > readlen && !seek_forward(in, len-readlen)))
{
fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n"));
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment