Skip to content

Fix i32 overflow in online status reporting for peers - #24

Closed
YuZhiYuanDev wants to merge 15 commits into
databk:masterfrom
rustdesk:master
Closed

Fix i32 overflow in online status reporting for peers#24
YuZhiYuanDev wants to merge 15 commits into
databk:masterfrom
rustdesk:master

Conversation

@YuZhiYuanDev

Copy link
Copy Markdown

No description provided.

rustdesk and others added 15 commits July 1, 2026 12:17
#676)

`Duration::as_millis()` returns u128; casting it `as i32` in the
online-status and punch-hole checks keeps only the low 32 bits as a
signed integer. Once a peer has not registered for more than 2^31 ms
(~24.855 days), the value wraps negative and passes the
`elapsed < REG_TIMEOUT` test, so a long-offline peer is reported online
and connection attempts are relayed to its stale socket_addr. The
in-memory peer map is never evicted, so last_reg_time stays frozen until
hbbs restarts, making the false-online window 24.86-49.71 days (and it
repeats every ~49.71 days).

Widen REG_TIMEOUT and the two elapsed casts from i32 to i64 so the
comparison no longer overflows.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bumps [libs/hbb_common](https://github.com/rustdesk/hbb_common) from `83419b6` to `5438d20`.
- [Release notes](https://github.com/rustdesk/hbb_common/releases)
- [Commits](rustdesk/hbb_common@83419b6...5438d20)

---
updated-dependencies:
- dependency-name: libs/hbb_common
  dependency-version: 5438d2022513573094c860e4035b4fb32a8e7787
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update protobuf to 3.7.2

Signed-off-by: Julien Arnaud <julien.arnaud@sib-retail.com>

* Harden protobuf recursion regression

Signed-off-by: Julien Arnaud <julien.arnaud@sib-retail.com>

---------

Signed-off-by: Julien Arnaud <julien.arnaud@sib-retail.com>
Co-authored-by: Julien Arnaud <julien.arnaud@sib-retail.com>
Bumps [libs/hbb_common](https://github.com/rustdesk/hbb_common) from `5438d20` to `69cea8d`.
- [Release notes](https://github.com/rustdesk/hbb_common/releases)
- [Commits](rustdesk/hbb_common@5438d20...69cea8d)

---
updated-dependencies:
- dependency-name: libs/hbb_common
  dependency-version: 69cea8dafee147848ae88702029f4bf7df7224c3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants