mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 19:54:39 +00:00
Apparent bug where min/max aren't initialized from value inside the buffer bounds.
The fix is less than ideal, it assumes that an incoming buffer length is always >= 1.
This commit is contained in:
parent
ebf103363c
commit
d02698a6de
@ -37,6 +37,12 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( statistics.count == 0 ) {
|
||||||
|
const auto value_0 = *p;
|
||||||
|
statistics.min = value_0;
|
||||||
|
statistics.max = value_0;
|
||||||
|
}
|
||||||
|
|
||||||
const auto end = &p[buffer.count];
|
const auto end = &p[buffer.count];
|
||||||
while(p < end) {
|
while(p < end) {
|
||||||
const uint32_t value = *(p++);
|
const uint32_t value = *(p++);
|
||||||
@ -58,9 +64,6 @@ public:
|
|||||||
callback(statistics);
|
callback(statistics);
|
||||||
statistics.accumulator = 0;
|
statistics.accumulator = 0;
|
||||||
statistics.count = 0;
|
statistics.count = 0;
|
||||||
const auto value_0 = *p;
|
|
||||||
statistics.min = value_0;
|
|
||||||
statistics.max = value_0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user