提交 fc6a3ef4 编写于 作者: A Anton Khirnov

audio_mix: fix zeroing output channels in certain cases

Specifically, when the corresponding input channel exists and its matrix
column is all-zero (which is necessary for zeroing the output), the
matrix column must be removed from the matrix.

This is not done currently, so the mixing code would end up using
uninitialized pointers from stack.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
上级 3d95d273
......@@ -559,9 +559,12 @@ static void reduce_matrix(AudioMix *am, const double *matrix, int stride)
if (zero) {
am->output_zero[o] = 1;
am->out_matrix_channels--;
if (o < am->in_channels)
am->in_matrix_channels--;
}
}
if (am->out_matrix_channels == 0) {
if (am->out_matrix_channels == 0 || am->in_matrix_channels == 0) {
am->out_matrix_channels = 0;
am->in_matrix_channels = 0;
return;
}
......@@ -683,7 +686,7 @@ int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)
am->in_matrix_channels; \
for (i = 0, i0 = 0; i < am->in_channels; i++) { \
double v; \
if (am->input_skip[i]) \
if (am->input_skip[i] || am->output_zero[i]) \
continue; \
v = matrix[o * stride + i]; \
am->matrix_## type[o0][i0] = expr; \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册