Skip to content

[gui] Some fixes to TGNumberEntry #18435

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

silverweed
Copy link
Contributor

An attempt to fix and improve some old code in TGNumberEntry by:

  • fixing some broken logic
  • simplifying some functions
  • improving safety by adding bounds checks where appropriate

This is not an exhaustive pass on the file, as there are many other places that could use a pass or a rewrite. However it should address some of the more glaring safety concerns - particularly, it removes all uses of strcpy and the coverity annotations.

I haven't tested this code yet so I'm opening this as a draft PR. Feel free to comment on it already.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #17334

@ferdymercury
Copy link
Contributor

Thanks a lot for this initiative. If you want a reproducer to test against: https://igit.ific.uv.es/ferhue/pulse-surfer

Copy link

github-actions bot commented Apr 17, 2025

Test Results

    17 files      17 suites   3d 6h 16m 48s ⏱️
 2 730 tests  2 729 ✅ 0 💤 1 ❌
45 031 runs  45 030 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 0d7826f.

♻️ This comment has been updated with latest results.

@silverweed silverweed marked this pull request as ready for review April 24, 2025 07:26
@silverweed silverweed requested a review from bellenot as a code owner April 24, 2025 07:26
@silverweed
Copy link
Contributor Author

silverweed commented Apr 24, 2025

I tested on @ferdymercury 's reproducer and it seems to work fine.

Copy link
Contributor

@ferdymercury ferdymercury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks! Maybe just add a small doxygen documentation on what CopyAndEliminate is doing.

- fix some broken logic
- simplify some functions
- improve safety by adding bounds checks where appropriate
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TGNumberEntry string length checks are inaccurate/dangerous.
2 participants