diff options
author | Mark Haines <mjark@negativecurvature.net> | 2016-05-25 15:00:05 +0100 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2016-05-25 15:00:05 +0100 |
commit | 19a7fb5df5ec3445201ce5fbe475a08faf6319fc (patch) | |
tree | e9f9ac72d035106a42260e792cdc0bad6c72fc4e /src/megolm.c | |
parent | 01ea3d4b9a3c6f3e0303c2d421a248715a96af99 (diff) |
Fix an integer wrap around bug and add a couple more tests
Diffstat (limited to 'src/megolm.c')
-rw-r--r-- | src/megolm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/megolm.c b/src/megolm.c index a969b36..affd3cb 100644 --- a/src/megolm.c +++ b/src/megolm.c @@ -116,7 +116,11 @@ void megolm_advance_to(Megolm *megolm, uint32_t advance_to) { ((advance_to >> shift) - (megolm->counter >> shift)) & 0xff; if (steps == 0) { - continue; + if (advance_to < megolm->counter) { + steps = 0x100; + } else { + continue; + } } /* for all but the last step, we can just bump R(j) without regard |