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:
commit
ceac78f07b
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue