Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alac: validate mid_side_shift to not overflow #341

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 whether it should also not be greater 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
Loading