U10: ec-aac output reorder returns Corrupt for a source plane index past the decoded planes instead of clamping it (unreachable for current channel layouts, so output is unchanged)
Browse files at this commitadeb90280c1831e1387e725d7719b460180227c2Parent: 1b477721 changed file +3 -1
- crates/ec-aac/src/lib.rs +3 -1
crates/ec-aac/src/lib.rsmodified+3 -1
| @@ -293,7 +293,9 @@ impl AacDecoder { | |||
| 293 | let frames = planes[0].len(); | 293 | let frames = planes[0].len(); |
| 294 | let mut samples = vec![0.0f32; frames * channels]; | 294 | let mut samples = vec![0.0f32; frames * channels]; |
| 295 | for (out_ch, &src) in order.iter().take(channels).enumerate() { | 295 | for (out_ch, &src) in order.iter().take(channels).enumerate() { |
| 296 | - let plane = &planes[src.min(channels - 1)]; | 296 | + let plane = planes |
| 297 | + .get(src) | ||
| 298 | + .ok_or_else(|| Error::corrupt("aac: channel order names a missing plane"))?; | ||
| 297 | // Planes can differ in length after `merge`; only the first `frames` samples fit. | 299 | // Planes can differ in length after `merge`; only the first `frames` samples fit. |
| 298 | for (i, &v) in plane.iter().take(frames).enumerate() { | 300 | for (i, &v) in plane.iter().take(frames).enumerate() { |
| 299 | samples[i * channels + out_ch] = v; | 301 | samples[i * channels + out_ch] = v; |