1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Merge branch 'fix-average-hook-oob-access' into 'master'

Fix out-of-bound access in average hook

Closes #249

See merge request acs/public/villas/node!60
This commit is contained in:
Steffen Vogel 2019-10-29 23:05:58 +01:00
commit ceac78f07b

View file

@ -39,7 +39,7 @@ namespace node {
class AverageHook : public Hook {
protected:
int offset;
unsigned offset;
std::bitset<MAX_SAMPLE_LENGTH> mask;
vlist signal_names;
@ -164,6 +164,10 @@ public:
}
avg = sum / n;
if (offset >= smp->length)
return Reason::ERROR;
sample_data_insert(smp, (union signal_data *) &avg, offset, 1);
smp->signals = &signals;