Skip to content

Commit

Permalink
A couple more cases where Dynamic Macros could get itself stuck in a
Browse files Browse the repository at this point in the history
nearly-infinite loop with bad data.
  • Loading branch information
obra committed Mar 5, 2024
1 parent 6bd594b commit 56dbb2d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ uint8_t DynamicMacros::updateDynamicMacroCache() {
uint8_t keyCode, flags;
do {
keyCode = Runtime.storage().read(pos++);
} while (keyCode != 0);
} while ((pos < (storage_base_ + storage_size_)) && keyCode != 0);
break;
}

Expand Down Expand Up @@ -170,7 +170,7 @@ void DynamicMacros::play(uint8_t macro_id) {
while (true) {
key.setFlags(isKeycodeSequence ? 0 : storage.read(pos++));
key.setKeyCode(storage.read(pos++));
if (key == Key_NoKey)
if (key == Key_NoKey || pos >= storage_base_ + storage_size_)
break;
tap(key);
delay(interval);
Expand Down

0 comments on commit 56dbb2d

Please sign in to comment.