Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix segfault in HTTP API rebind #3420

Merged
merged 1 commit into from Feb 25, 2024
Merged

Conversation

Daviey
Copy link
Contributor

@Daviey Daviey commented Feb 11, 2024

Previously with HTTP API enabled on brenchmarking run, it is possible to cause a segfault due to an issue handling the m_httpd pointer and rebinding.

  • Initialize m_httpd to nullptr to indicate when it's not in use.
  • Safely delete m_httpd in Api's destructor to prevent use-after-free issues.
  • Add checks to ensure m_httpd is not nullptr before usage in start, stop, and tick methods.
  • Log errors for HTTP server start failures to aid in debugging.

Fixes MoneroOcean#120

Previously with HTTP API enabled on brenchmarking run, it is possible
to cause a segfault due to an issue handling the m_httpd pointer and
rebinding.

  - Initialize m_httpd to nullptr to indicate when it's not in use.
  - Safely delete m_httpd in Api's destructor to prevent use-after-free
    issues.
  - Add checks to ensure m_httpd is not nullptr before usage in start,
    stop, and tick methods.
  - Log errors for HTTP server start failures to aid in debugging.

Fixes MoneroOcean#120

Signed-off-by: Dave Walker (Daviey) <email@daviey.com>
@xmrig
Copy link
Owner

xmrig commented Feb 12, 2024

Merged into dev branch.
Thank you.

@xmrig xmrig added the bug label Feb 12, 2024
@xmrig xmrig added this to the v6 milestone Feb 12, 2024
@xmrig xmrig merged commit 2c9c40d into xmrig:master Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault on v6.20.0 when API HTTP enabled
3 participants