siren: fix a global buffer overflow spotted by asan

This patch just enforces boudaries for the access to the
standard_deviation array (64 floats). Such case can be
seen with a corrupted stream, where there's no hope to
obtain a valid decoded frame anyway.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1002
This commit is contained in:
Fabrice Bellet 2019-07-22 08:00:00 +00:00 committed by Sebastian Dröge
parent 7de6b5d481
commit 96004cd751

View file

@ -153,6 +153,10 @@ decode_envelope (int number_of_regions, float *decoder_standard_deviation,
absolute_region_power_index[i] =
absolute_region_power_index[i - 1] - index - 12;
if (absolute_region_power_index[i] < -24)
absolute_region_power_index[i] = -24;
else if (absolute_region_power_index[i] > 39)
absolute_region_power_index[i] = 39;
decoder_standard_deviation[i] =
standard_deviation[absolute_region_power_index[i] + 24];
}