Removed
Link Here
|
1 |
Obtained from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508133#15 |
2 |
|
3 |
--- layer12.c.orig 2004-02-05 09:02:39 UTC |
4 |
+++ layer12.c |
5 |
@@ -134,6 +134,12 @@ int mad_layer_I(struct mad_stream *strea |
6 |
for (sb = 0; sb < bound; ++sb) { |
7 |
for (ch = 0; ch < nch; ++ch) { |
8 |
nb = mad_bit_read(&stream->ptr, 4); |
9 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
10 |
+ { |
11 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
12 |
+ stream->sync = 0; |
13 |
+ return -1; |
14 |
+ } |
15 |
|
16 |
if (nb == 15) { |
17 |
stream->error = MAD_ERROR_BADBITALLOC; |
18 |
@@ -146,6 +152,12 @@ int mad_layer_I(struct mad_stream *strea |
19 |
|
20 |
for (sb = bound; sb < 32; ++sb) { |
21 |
nb = mad_bit_read(&stream->ptr, 4); |
22 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
23 |
+ { |
24 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
25 |
+ stream->sync = 0; |
26 |
+ return -1; |
27 |
+ } |
28 |
|
29 |
if (nb == 15) { |
30 |
stream->error = MAD_ERROR_BADBITALLOC; |
31 |
@@ -162,6 +174,12 @@ int mad_layer_I(struct mad_stream *strea |
32 |
for (ch = 0; ch < nch; ++ch) { |
33 |
if (allocation[ch][sb]) { |
34 |
scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); |
35 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
36 |
+ { |
37 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
38 |
+ stream->sync = 0; |
39 |
+ return -1; |
40 |
+ } |
41 |
|
42 |
# if defined(OPT_STRICT) |
43 |
/* |
44 |
@@ -187,6 +205,12 @@ int mad_layer_I(struct mad_stream *strea |
45 |
frame->sbsample[ch][s][sb] = nb ? |
46 |
mad_f_mul(I_sample(&stream->ptr, nb), |
47 |
sf_table[scalefactor[ch][sb]]) : 0; |
48 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
49 |
+ { |
50 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
51 |
+ stream->sync = 0; |
52 |
+ return -1; |
53 |
+ } |
54 |
} |
55 |
} |
56 |
|
57 |
@@ -195,6 +219,12 @@ int mad_layer_I(struct mad_stream *strea |
58 |
mad_fixed_t sample; |
59 |
|
60 |
sample = I_sample(&stream->ptr, nb); |
61 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
62 |
+ { |
63 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
64 |
+ stream->sync = 0; |
65 |
+ return -1; |
66 |
+ } |
67 |
|
68 |
for (ch = 0; ch < nch; ++ch) { |
69 |
frame->sbsample[ch][s][sb] = |
70 |
@@ -403,7 +433,15 @@ int mad_layer_II(struct mad_stream *stre |
71 |
nbal = bitalloc_table[offsets[sb]].nbal; |
72 |
|
73 |
for (ch = 0; ch < nch; ++ch) |
74 |
+ { |
75 |
allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); |
76 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
77 |
+ { |
78 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
79 |
+ stream->sync = 0; |
80 |
+ return -1; |
81 |
+ } |
82 |
+ } |
83 |
} |
84 |
|
85 |
for (sb = bound; sb < sblimit; ++sb) { |
86 |
@@ -411,6 +449,13 @@ int mad_layer_II(struct mad_stream *stre |
87 |
|
88 |
allocation[0][sb] = |
89 |
allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); |
90 |
+ |
91 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
92 |
+ { |
93 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
94 |
+ stream->sync = 0; |
95 |
+ return -1; |
96 |
+ } |
97 |
} |
98 |
|
99 |
/* decode scalefactor selection info */ |
100 |
@@ -419,6 +464,12 @@ int mad_layer_II(struct mad_stream *stre |
101 |
for (ch = 0; ch < nch; ++ch) { |
102 |
if (allocation[ch][sb]) |
103 |
scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); |
104 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
105 |
+ { |
106 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
107 |
+ stream->sync = 0; |
108 |
+ return -1; |
109 |
+ } |
110 |
} |
111 |
} |
112 |
|
113 |
@@ -442,6 +493,12 @@ int mad_layer_II(struct mad_stream *stre |
114 |
for (ch = 0; ch < nch; ++ch) { |
115 |
if (allocation[ch][sb]) { |
116 |
scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); |
117 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
118 |
+ { |
119 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
120 |
+ stream->sync = 0; |
121 |
+ return -1; |
122 |
+ } |
123 |
|
124 |
switch (scfsi[ch][sb]) { |
125 |
case 2: |
126 |
@@ -452,11 +509,23 @@ int mad_layer_II(struct mad_stream *stre |
127 |
|
128 |
case 0: |
129 |
scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); |
130 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
131 |
+ { |
132 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
133 |
+ stream->sync = 0; |
134 |
+ return -1; |
135 |
+ } |
136 |
/* fall through */ |
137 |
|
138 |
case 1: |
139 |
case 3: |
140 |
scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); |
141 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
142 |
+ { |
143 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
144 |
+ stream->sync = 0; |
145 |
+ return -1; |
146 |
+ } |
147 |
} |
148 |
|
149 |
if (scfsi[ch][sb] & 1) |
150 |
@@ -488,6 +557,12 @@ int mad_layer_II(struct mad_stream *stre |
151 |
index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; |
152 |
|
153 |
II_samples(&stream->ptr, &qc_table[index], samples); |
154 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
155 |
+ { |
156 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
157 |
+ stream->sync = 0; |
158 |
+ return -1; |
159 |
+ } |
160 |
|
161 |
for (s = 0; s < 3; ++s) { |
162 |
frame->sbsample[ch][3 * gr + s][sb] = |
163 |
@@ -506,6 +581,12 @@ int mad_layer_II(struct mad_stream *stre |
164 |
index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; |
165 |
|
166 |
II_samples(&stream->ptr, &qc_table[index], samples); |
167 |
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) |
168 |
+ { |
169 |
+ stream->error = MAD_ERROR_LOSTSYNC; |
170 |
+ stream->sync = 0; |
171 |
+ return -1; |
172 |
+ } |
173 |
|
174 |
for (ch = 0; ch < nch; ++ch) { |
175 |
for (s = 0; s < 3; ++s) { |