Minimal fix to get it promptly into 25.0 release (suggested by stickies-v and supported by vasild )
Please check #27253 for reviewers comments and acks regarding this PR and read the commit comment message body for more details about the fix.
Minimal fix to get it promptly into 25.0 release (suggested by stickies-v and supported by vasild )
Please check #27253 for reviewers comments and acks regarding this PR and read the commit comment message body for more details about the fix.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | stickies-v, achow101 |
Stale ACK | vasild |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
It’s still possible to provoke a segfault via the /rest/mempool
endpoint, which also uses GetQueryParameter()
(tested on a bitcoind -signet -rest
instance):
0$ curl localhost:38332/rest/mempool/contents.json?%
1curl: (52) Empty reply from server
2
3bitcoind output:
4libc++abi: terminating with uncaught exception of type std::runtime_error: URI parsing failed, it likely contained RFC 3986 invalid characters
5Abort trap (core dumped)
Should be easy to fix by catching std::runtime_error
also at the proper places within rest_mempool
.
It’s still possible to provoke a segfault via the
/rest/mempool
endpoint, which also usesGetQueryParameter()
(tested on abitcoind -signet -rest
instance):
Thanks @theStack. I’ll fix it asap.
`evhttp_uri_parse` can return a nullptr, for example when the URI
contains invalid characters (e.g. "%").
`GetQueryParameterFromUri` passes the output of `evhttp_uri_parse`
straight into `evhttp_uri_get_query`, which means that anyone calling
a REST endpoint in which query parameters are used (e.g. `rest_headers`)
can cause a segfault.
This bugfix is designed to be minimal and without additional behaviour change.
Follow-up work should be done to resolve this in a more general and robust way,
so not every endpoint has to handle it individually.
Updated changes:
rest/mempool
endpoint that was also calling GetQueryParameter()
.