View | Details | Raw Unified | Return to bug 202941 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	vorbis-tools
4
PORTNAME=	vorbis-tools
5
PORTVERSION=	1.4.0
5
PORTVERSION=	1.4.0
6
PORTREVISION=	9
6
PORTREVISION=	10
7
PORTEPOCH=	3
7
PORTEPOCH=	3
8
CATEGORIES=	audio
8
CATEGORIES=	audio
9
MASTER_SITES=	http://downloads.xiph.org/releases/vorbis/
9
MASTER_SITES=	http://downloads.xiph.org/releases/vorbis/
(-)files/patch-oggenc_audio.c (-2 / +60 lines)
Lines 1-6 Link Here
1
--- oggenc/audio.c.orig	2010-03-24 08:27:14 UTC
1
--- oggenc/audio.c.orig	2010-03-24 08:27:14 UTC
2
+++ oggenc/audio.c
2
+++ oggenc/audio.c
3
@@ -245,8 +245,8 @@ static int aiff_permute_matrix[6][6] = 
3
@@ -13,6 +13,7 @@
4
 #include <config.h>
5
 #endif
6
 
7
+#include <limits.h>
8
 #include <stdlib.h>
9
 #include <stdio.h>
10
 #include <string.h>
11
@@ -245,12 +246,13 @@ static int aiff_permute_matrix[6][6] = 
4
 int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
12
 int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
5
 {
13
 {
6
     int aifc; /* AIFC or AIFF? */
14
     int aifc; /* AIFC or AIFF? */
Lines 11-17 Link Here
11
     unsigned char buf2[8];
19
     unsigned char buf2[8];
12
     aiff_fmt format;
20
     aiff_fmt format;
13
     aifffile *aiff = malloc(sizeof(aifffile));
21
     aifffile *aiff = malloc(sizeof(aifffile));
14
@@ -269,9 +269,9 @@ int aiff_open(FILE *in, oe_enc_opt *opt,
22
     int i;
23
+    long channels;
24
 
25
     if(buf[11]=='C')
26
         aifc=1;
27
@@ -269,19 +271,25 @@ int aiff_open(FILE *in, oe_enc_opt *opt,
15
         return 0; /* Weird common chunk */
28
         return 0; /* Weird common chunk */
16
     }
29
     }
17
 
30
 
Lines 24-26 Link Here
24
     {
37
     {
25
         fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n"));
38
         fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n"));
26
         return 0;
39
         return 0;
40
     }
41
 
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);
47
 
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
+
54
     aiff->bigendian = 1;
55
 
56
     if(aifc)
57
@@ -412,6 +420,7 @@ int wav_open(FILE *in, oe_enc_opt *opt, 
58
     wav_fmt format;
59
     wavfile *wav = malloc(sizeof(wavfile));
60
     int i;
61
+    long channels;
62
 
63
     /* Ok. At this point, we know we have a WAV file. Now we have to detect
64
      * whether we support the subtype, and we have to find the actual data
65
@@ -449,12 +458,18 @@ int wav_open(FILE *in, oe_enc_opt *opt, 
66
     }
67
 
68
     format.format =      READ_U16_LE(buf);
69
-    format.channels =    READ_U16_LE(buf+2);
70
+    format.channels = channels = READ_U16_LE(buf+2);
71
     format.samplerate =  READ_U32_LE(buf+4);
72
     format.bytespersec = READ_U32_LE(buf+8);
73
     format.align =       READ_U16_LE(buf+12);
74
     format.samplesize =  READ_U16_LE(buf+14);
75
 
76
+    if(channels <= 0L || SHRT_MAX < channels)
77
+    {
78
+        fprintf(stderr, _("Warning: Unsupported count of channels in WAV header\n"));
79
+        return 0;
80
+    }
81
+
82
     if(format.format == -2) /* WAVE_FORMAT_EXTENSIBLE */
83
     {
84
       if(len<40)
(-)files/patch-oggenc_oggenc.c (+21 lines)
Line 0 Link Here
1
--- oggenc/oggenc.c.orig	2010-03-26 07:07:07 UTC
2
+++ oggenc/oggenc.c
3
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
4
               .3,-1,
5
               0,0,0.f,
6
               0, 0, 0, 0, 0};
7
+    input_format raw_format = {NULL, 0, raw_open, wav_close, "raw",
8
+      N_("RAW file reader")};
9
 
10
     int i;
11
 
12
@@ -239,9 +241,6 @@ int main(int argc, char **argv)
13
 
14
         if(opt.rawmode)
15
         {
16
-            input_format raw_format = {NULL, 0, raw_open, wav_close, "raw", 
17
-                N_("RAW file reader")};
18
-
19
             enc_opts.rate=opt.raw_samplerate;
20
             enc_opts.channels=opt.raw_channels;
21
             enc_opts.samplesize=opt.raw_samplesize;

Return to bug 202941