Skip to content

Fix segfault in HTTP API rebind#3420

Merged
xmrig merged 1 commit into
xmrig:masterfrom
Daviey:HTTPRebindSegFault
Feb 25, 2024
Merged

Fix segfault in HTTP API rebind#3420
xmrig merged 1 commit into
xmrig:masterfrom
Daviey:HTTPRebindSegFault

Conversation

@Daviey

@Daviey Daviey commented Feb 11, 2024

Copy link
Copy Markdown
Contributor

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

xmrig commented Feb 12, 2024

Copy link
Copy Markdown
Owner

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