Skip to content

Commit

Permalink
[PluginServer] Ensure valid activate/termination conditions are used (#…
Browse files Browse the repository at this point in the history
…1443)

Co-authored-by: Pierre Wielders <[email protected]>
  • Loading branch information
sebaszm and pwielders authored Nov 3, 2023
1 parent 7ba9212 commit d0c811e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/WPEFramework/PluginServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1046,14 +1046,18 @@ namespace PluginHost {
// Its a NOT value, so this bit should *not* be set and this 0
bitNr -= ISubSystem::NEGATIVE_START;

ASSERT_VERBOSE(((_state & 0x3) == state::STATE_OR), "Must not use NOT_ in preconditions (subsystem 0x%08x)", input);

// Make sure the event is only set once (POSITIVE or NEGATIVE)
if (((_mask & (1 << bitNr)) != 0) && ((_events & (1 << bitNr)) != 0)) {
if ((((_mask & (1 << bitNr)) != 0) && ((_events & (1 << bitNr)) != 0)) || ((_state & 0x3) == state::STATE_OR)) {
_state = STATE_ERROR;
}
}
else {
ASSERT_VERBOSE(((_state & 0x3) == state::STATE_AND), "Must only use NOT_ in terminations (subsystem 0x%08x)", input);

// Make sure the event is only set once (POSITIVE or NEGATIVE)
if (((_mask & (1 << bitNr)) != 0) && ((_events & (1 << bitNr)) == 0)) {
if ((((_mask & (1 << bitNr)) != 0) && ((_events & (1 << bitNr)) == 0)) || ((_state & 0x3) == state::STATE_AND)) {
_state = STATE_ERROR;
}
else {
Expand Down

0 comments on commit d0c811e

Please sign in to comment.