Lagrang3
7e5cf41b4e
htlc_wire: fix crash when adding an HTLC
In line channeld/channeld_wiregen.c:832 `*added+i` is not a tal object hence
the instruction in common/htlc_wire.c:200 `tal_arr(ctx, struct tlv_field, 0);` crashes CLN.
This is fixed by stating that added_htlc is a a varsize_type.
Logs:
2025-08-16T02:25:28.640Z **BROKEN** lightningd: FATAL SIGNAL 6 (version v25.05-200-g79b959b)V
...
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/tal/tal.c:95 (call_error) 0x54f6bc
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/tal/tal.c:169 (check_bounds) 0x54f75a
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/tal/tal.c:178 (to_tal_hdr) 0x54f782
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/tal/tal.c:193 (to_tal_hdr_or_null) 0x54f7c7
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/tal/tal.c:471 (tal_alloc_) 0x54ffe4
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/tal/tal.c:517 (tal_alloc_arr_) 0x5500c4
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: common/htlc_wire.c:200 (fromwire_len_and_tlvstream) 0x48d63d
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: common/htlc_wire.c:234 (fromwire_added_htlc) 0x48dd23
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: channeld/channeld_wiregen.c:832 (fromwire_channeld_got_commitsig) 0x4c61fa
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: lightningd/peer_htlcs.c:2377 (peer_got_commitsig) 0x4549cb
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: lightningd/channel_control.c:1552 (channel_msg) 0x4140fe
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: lightningd/subd.c:560 (sd_msg_read) 0x461513
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:60 (next_plan) 0x544885
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:422 (do_plan) 0x544cea
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:439 (io_ready) 0x544d9d
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: ccan/ccan/io/poll.c:455 (io_loop) 0x54665d
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: lightningd/io_loop_with_timers.c:22 (io_loop_with_timers) 0x42d220
2025-08-16T02:25:28.640Z **BROKEN** lightningd: backtrace: lightningd/lightningd.c:1487 (main) 0x43280f
gdb inspection:
830 *added = num_added ? tal_arr(ctx, struct added_htlc, num_added) : NULL;
831 for (size_t i = 0; i < num_added; i++)
832 fromwire_added_htlc(&cursor, &plen, *added + i);
(gdb) p i
$3 = 1
Changelog-None: crash introduced this release.
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
[ Added test, removed Changelog --RR ]
2025-08-27 14:14:31 +09:30
..
2025-08-19 13:37:50 +09:30
2024-11-12 06:42:52 +10:30
2024-11-12 06:42:52 +10:30
2025-07-19 10:09:17 +09:30
2025-07-19 10:09:17 +09:30
2025-07-08 12:54:56 +09:30
2025-07-08 12:54:56 +09:30
2024-05-18 10:02:43 +02:00
2023-05-27 15:06:31 +09:30
2023-05-27 15:06:31 +09:30
2024-10-16 07:14:32 +10:30
2024-10-16 07:14:32 +10:30
2024-10-16 07:14:32 +10:30
2023-01-30 13:24:29 +10:30
2024-10-16 07:14:32 +10:30
2024-10-16 07:14:32 +10:30
2024-03-20 13:51:48 +10:30
2024-03-20 13:51:48 +10:30
2024-03-20 13:51:48 +10:30
2025-08-15 10:15:16 +09:30
2023-09-21 20:08:24 +09:30
2024-08-01 12:31:48 +09:30
2024-08-01 12:31:48 +09:30
2025-02-11 20:19:01 -06:00
2024-08-01 12:31:48 +09:30
2025-08-18 14:57:46 +09:30
2025-08-18 14:57:46 +09:30
2024-05-09 16:14:23 -05:00
2024-07-23 09:54:47 +09:30
2024-11-12 06:42:52 +10:30
2025-08-13 14:20:28 +09:30
2025-08-13 14:20:28 +09:30
2025-03-18 14:30:58 +10:30
2023-08-02 16:12:32 +09:30
2023-08-02 16:12:32 +09:30
2025-08-21 13:21:17 +09:30
2025-08-19 13:37:50 +09:30
2025-02-24 19:38:37 +10:30
2025-02-24 19:38:37 +10:30
2024-08-10 15:20:59 +09:30
2025-02-24 19:38:37 +10:30
2023-09-20 13:56:46 +09:30
2023-06-23 13:12:42 +09:30
2025-05-08 14:01:38 +09:30
2024-03-20 11:18:36 +10:30
2024-07-10 12:21:19 +09:30
2025-02-14 22:17:21 +10:30
2024-01-26 10:30:22 +10:30
2024-07-23 09:54:47 +09:30
2023-09-21 20:08:24 +09:30
2025-01-27 11:07:04 +10:30
2025-01-27 11:07:04 +10:30
2025-04-29 09:40:15 -07:00
2024-03-07 14:09:14 +01:00
2025-03-18 14:30:58 +10:30
2025-03-18 14:30:58 +10:30
2024-05-13 14:06:45 -05:00
2024-05-13 14:06:45 -05:00
2025-03-18 14:30:58 +10:30
2023-01-30 15:15:41 -06:00
2024-02-12 11:43:33 +01:00
2025-08-14 16:40:04 +09:30
2025-02-11 15:11:47 -06:00
2025-02-21 17:03:36 -06:00
2025-02-21 17:03:36 -06:00
2024-07-23 09:54:47 +09:30
2024-01-29 12:02:37 +10:30
2024-01-29 12:02:37 +10:30
2024-11-13 08:49:55 +10:30
2024-11-13 08:49:55 +10:30
2025-05-13 13:19:03 +09:30
2023-06-29 11:28:47 -04:00
2023-06-29 11:28:47 -04:00
2023-06-29 11:28:47 -04:00
2024-06-19 15:54:24 +09:30
2025-08-27 14:14:31 +09:30
2025-08-27 14:14:31 +09:30
2024-06-19 15:54:24 +09:30
2024-03-20 13:51:48 +10:30
2024-03-20 13:51:48 +10:30
2023-06-29 11:28:47 -04:00
2025-08-14 16:40:04 +09:30
2024-11-21 14:15:36 +10:30
2025-02-11 20:19:01 -06:00
2024-10-16 07:14:32 +10:30
2024-05-12 19:11:43 -05:00
2024-01-29 13:40:34 +10:30
2024-01-29 13:40:34 +10:30
2024-06-25 08:47:50 +09:30
2024-06-25 08:47:50 +09:30
2022-11-09 20:25:58 +10:30
2022-11-09 20:25:58 +10:30
2025-08-19 13:37:50 +09:30
2025-08-19 13:37:50 +09:30
2025-08-15 10:15:16 +09:30
2025-08-14 17:53:39 +09:30
2025-08-18 14:03:20 +09:30
2024-10-04 11:27:53 +09:30
2025-08-14 16:52:44 +09:30
2025-08-14 16:52:44 +09:30
2024-11-21 14:15:36 +10:30
2025-02-11 20:19:01 -06:00
2023-03-22 13:50:32 +10:30
2025-02-11 20:19:01 -06:00
2024-11-12 06:42:52 +10:30
2023-10-03 10:05:55 +02:00
2023-10-03 10:05:55 +02:00
2024-11-01 16:54:49 +10:30
2024-03-20 13:51:48 +10:30
2024-03-20 13:51:48 +10:30
2024-11-20 12:29:27 +01:00
2024-11-20 12:29:27 +01:00
2024-10-16 07:14:32 +10:30
2024-10-16 07:14:32 +10:30
2025-02-11 20:19:01 -06:00
2024-10-16 07:14:32 +10:30
2024-10-16 07:14:32 +10:30
2024-10-16 07:14:32 +10:30
2023-10-23 15:48:50 +10:30
2023-10-23 15:48:50 +10:30
2023-10-23 15:48:50 +10:30
2023-03-23 16:10:55 +10:30
2023-09-21 20:08:24 +09:30
2024-05-17 13:03:12 -05:00
2024-05-17 13:03:12 -05:00
2025-08-14 04:12:17 +09:30
2023-07-31 21:00:22 +09:30
2023-07-11 11:41:15 +09:30
2023-07-11 11:41:15 +09:30
2025-08-14 04:12:17 +09:30
2024-11-12 06:42:52 +10:30
2025-02-11 16:54:08 -06:00
2023-08-12 09:24:06 +09:30
2023-10-23 15:48:50 +10:30
2023-10-23 15:48:50 +10:30
2024-10-07 14:05:47 +02:00
2024-10-07 14:05:47 +02:00
2025-02-22 11:51:54 -06:00
2024-05-12 19:11:43 -05:00
2024-05-12 19:11:43 -05:00
2025-05-13 14:52:15 +09:30
2025-03-18 14:30:58 +10:30
2025-03-18 14:30:58 +10:30
2024-11-18 11:03:26 +10:30
2024-11-18 11:03:26 +10:30
2025-08-18 14:03:20 +09:30
2024-11-12 06:42:52 +10:30
2024-05-08 21:05:49 -05:00
2024-05-08 21:05:49 -05:00
2024-12-16 09:48:51 +10:30
2024-12-16 09:48:51 +10:30
2024-12-16 09:48:51 +10:30
2023-09-21 20:08:24 +09:30
2025-04-24 17:34:12 +09:30
2025-04-23 13:45:18 +09:30
2023-02-07 21:03:36 -06:00
2023-02-07 21:03:36 -06:00
2025-05-13 14:52:15 +09:30
2025-05-13 14:52:15 +09:30
2025-05-06 12:27:53 +09:30
2025-05-06 12:27:53 +09:30
2023-06-03 10:50:29 +09:30
2023-06-03 10:50:29 +09:30
2023-01-30 15:15:41 -06:00
2024-11-21 14:15:36 +10:30
2024-11-21 14:15:36 +10:30
2024-11-25 15:39:13 +10:30
2024-11-25 15:39:13 +10:30