Commit ceac78f0 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼

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

Fix out-of-bound access in average hook

Closes #249

See merge request !60
parents 713e875f a49e1165
...@@ -39,7 +39,7 @@ namespace node { ...@@ -39,7 +39,7 @@ namespace node {
class AverageHook : public Hook { class AverageHook : public Hook {
protected: protected:
int offset; unsigned offset;
std::bitset<MAX_SAMPLE_LENGTH> mask; std::bitset<MAX_SAMPLE_LENGTH> mask;
vlist signal_names; vlist signal_names;
...@@ -164,6 +164,10 @@ public: ...@@ -164,6 +164,10 @@ public:
} }
avg = sum / n; avg = sum / n;
if (offset >= smp->length)
return Reason::ERROR;
sample_data_insert(smp, (union signal_data *) &avg, offset, 1); sample_data_insert(smp, (union signal_data *) &avg, offset, 1);
smp->signals = &signals; smp->signals = &signals;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment