Fix crash in noise reduction

Fix upper bound for array access while building histogram of absolute
values in mean absolute deviation (MAD) calculation.

Fixes #6871.
This commit is contained in:
Lawrence Lee
2023-10-29 16:20:12 -07:00
parent 72bf271214
commit 0e835e8c00

View File

@@ -2106,7 +2106,7 @@ float ImProcFunctions::Mad(const float * DataList, const int datalen)
//calculate histogram of absolute values of wavelet coeffs
for (int i = 0; i < datalen; ++i) {
histo[static_cast<int>(rtengine::min(32768.f, fabsf(DataList[i])))]++;
histo[static_cast<int>(rtengine::min(32767.f, fabsf(DataList[i])))]++;
}
//find median of histogram