Skip to content

upnp: defer cleanup for HTTP status errors - #2577

Merged
MaxKellermann merged 1 commit into
MusicPlayerDaemon:v0.24.xfrom
acts-1631:fix/upnp-http-error-lifetime
Aug 26, 2026
Merged

MaxKellermann merged 1 commit into
MusicPlayerDaemon:v0.24.xfrom
acts-1631:fix/upnp-http-error-lifetime

Conversation

@acts-1631

Copy link
Copy Markdown
Contributor

The UPnP device description downloader deleted itself from OnHeaders() when a server returned a non-200 status. CurlResponseHandlerAdapter then continued DataReceived() and called OnData() through the deleted request, causing a use-after-free. A UPnP server on the local network can trigger this when the UPnP database or neighbor plugin is enabled.

Throw HttpStatusError instead. The curl adapter records the exception, aborts the transfer, and invokes OnError() after leaving the data callback, where the downloader can be destroyed safely.

Deleting the device description downloader from OnHeaders() frees the
CurlResponseHandlerAdapter while DataReceived() still uses it. A UPnP
server can trigger a use-after-free by returning a non-200 response with
body data.

Throw HttpStatusError so the adapter defers cleanup until OnError().
@MaxKellermann
MaxKellermann merged commit 1972176 into MusicPlayerDaemon:v0.24.x Aug 26, 2026
10 checks passed
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.

2 participants