-
Notifications
You must be signed in to change notification settings - Fork 967
lightningd: fix segfault when parse_filter fails #8780
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
base: master
Are you sure you want to change the base?
Conversation
|
@ShahanaFarooqui has investigated the CI failures... Christian and Rusty are working on resolving some CI problems right now. Shahana also noticed you forgot to add a Changelog entry in the commit.... here is the guide. You'll need to fix this: a very important habit! Not adding a Changelog entry can also fail CI (when it's working as expected). Well done and congratulations on your first PR for CLN! |
7983aaf to
3851187
Compare
|
@dovgopoly Thanks for the PR! I updated your commit message to include a ::error::'Changelog' entry is missing in all commits, and 'Changelog-None' not specified in the PR descriptionHowever, for some strange reason, the CI didn’t even start the pre-build this time. Adding the By the way, feel free to edit the commit message as you see fit, I just added it to test the CI flow. :). |
|
Thanks! Great find! Since this is your first PR I'm going to nitpick!
|
3851187 to
d0c0654
Compare
2-3. Fixed. |
d0c0654 to
c23b163
Compare
|
And here's the blog post I made about it, with video! https://rusty.ozlabs.org/2025/12/12/CLN-Neatening-A-Bugfix-PR.html |
We need to initialize ->json_cmd *before* complaining about malformed
filters.
```
lightningd: FATAL SIGNAL 11 (version v25.12-21-g3851187-modded)
0x1042d2023 ???
send_backtrace+0x4f:0
0x1042d20cb ???
crashdump+0x43:0
0x19fe3b743 ???
???:0
0x104180173 command_log
lightningd/jsonrpc.c:1406
0x10420d8f7 command_fail_badparam
common/json_command.c:25
0x104181a07 parse_request
lightningd/jsonrpc.c:1075
0x104181a07 read_json
lightningd/jsonrpc.c:1216
0x10424c65b next_plan
ccan/ccan/io/io.c:60
0x10424c65b do_plan
ccan/ccan/io/io.c:422
0x10424c587 io_ready
ccan/ccan/io/io.c:439
0x10424dd9b io_loop
ccan/ccan/io/poll.c:470
0x10417ede7 io_loop_with_timers
lightningd/io_loop_with_timers.c:22
0x104183a33 main
lightningd/lightningd.c:1492
```
Co-authored-by: Rusty Russell <[email protected]>
Changelog-Fixed: JSON-RPC: malformed filters no longer crash lightningd.
5da250a to
2ade704
Compare
|
Thanks! It was an awesome blog post :) |
Fixes #8442
parse_filter()expects aJSMN_OBJECT. When not aJSMN_OBJECTis passed to thefilterparameter, it calledcommand_fail_badparam()which calledcommand_log()that tried to accessc->json_cmd->name, butc->json_cmdwas stillNULLbecausefind_cmd()hadn't been called yet.Example that triggered the crash:
./cli/lightning-cli wait -l 'invalid_json_object' -k subsystem=invoices indexname=created nextvalue=0 --network regtest