Skip to content

Commit

Permalink
alac: validate mid_side_shift to not overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sscobici committed Jan 17, 2025
1 parent 0d10b52 commit 6788d7c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions symphonia-codec-alac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,12 @@ fn decode_sce_or_cpe<B: ReadBitsLtr>(
elem1.predict(&mut out1[..num_samples])?;

if mid_side_weight != 0 {
// mid_side_shift should not be bigger than 31 bits as we are shifting i32 to the right
// TODO validate if it should be not bigger than config.bit_depth
if mid_side_shift > 31 {
return decode_error("alac: mid_side_shift is greater than 31 bit");
}

decorrelate_mid_side(out0, out1, mid_side_weight, mid_side_shift);
}
}
Expand Down

0 comments on commit 6788d7c

Please sign in to comment.