File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
symphonia-codec-aac/src/aac Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ impl ChannelPair {
59
59
60
60
if common_window {
61
61
// Decode the common ICS info block into the first channel.
62
- self . ics0 . info . decode ( bs) ?;
62
+ // do not call self.ics0.info.decode() as it will skip required validations present in self.ics0.decode_info()
63
+ self . ics0 . decode_info ( bs) ?;
63
64
64
65
// Mid-side stereo mask decoding.
65
66
self . ms_mask_present = bs. read_bits_leq32 ( 2 ) ? as u8 ;
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ impl IcsInfo {
106
106
}
107
107
}
108
108
109
+ /// this method should be called from Ics::decode_info() which will perform additional validations for max_sfb
109
110
pub fn decode < B : ReadBitsLtr > ( & mut self , bs : & mut B ) -> Result < ( ) > {
110
111
self . prev_window_sequence = self . window_sequence ;
111
112
self . prev_window_shape = self . window_shape ;
@@ -291,6 +292,16 @@ impl Ics {
291
292
self . sfb_cb [ g] [ sfb] == INTENSITY_HCB
292
293
}
293
294
295
+ pub fn decode_info < B : ReadBitsLtr > ( & mut self , bs : & mut B ) -> Result < ( ) > {
296
+ self . info . decode ( bs) ?;
297
+
298
+ // validate info.max_sfb - it should not be bigger than bands array len - 1
299
+ if self . info . max_sfb + 1 > self . get_bands ( ) . len ( ) {
300
+ return decode_error ( "aac: ics info max_sfb is too big for the bands size" ) ;
301
+ }
302
+ Ok ( ( ) )
303
+ }
304
+
294
305
fn decode_scale_factor_data < B : ReadBitsLtr > ( & mut self , bs : & mut B ) -> Result < ( ) > {
295
306
let mut noise_pcm_flag = true ;
296
307
let mut scf_intensity = -INTENSITY_SCALE_MIN ;
@@ -407,7 +418,8 @@ impl Ics {
407
418
408
419
// If a common window is used, a common ICS info was decoded previously.
409
420
if !common_window {
410
- self . info . decode ( bs) ?;
421
+ // do not call self.info.decode() as it will skip required validations present in the decode_info()
422
+ self . decode_info ( bs) ?;
411
423
}
412
424
413
425
self . decode_section_data ( bs) ?;
You can’t perform that action at this time.
0 commit comments