mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
bitcoin: avoid adding to NULL
Detected by UBSan: $ UBSAN_OPTIONS=print_stacktrace=1 ./wallet/test/run-psbt_fixup bitcoin/psbt.c:733:2: runtime error: applying zero offset to null pointer #0 0x53c829 in psbt_from_bytes lightning/bitcoin/psbt.c:733:2 #1 0x5adcb0 in main lightning/wallet/test/run-psbt_fixup.c:174:10 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior bitcoin/psbt.c:733:2
This commit is contained in:
parent
73b73483bf
commit
c05d7e4f78
@ -123,10 +123,10 @@ void tal_wally_end(const tal_t *parent);
|
||||
/* ... or this if you want to reparent onto something which is
|
||||
* allocated by libwally here. Fixes up this from_wally obj to have a
|
||||
* proper tal_name, too! */
|
||||
#define tal_wally_end_onto(parent, from_wally, type) \
|
||||
tal_wally_end_onto_((parent), \
|
||||
(from_wally) + 0*sizeof((from_wally) == (type *)0), \
|
||||
stringify(type))
|
||||
#define tal_wally_end_onto(parent, from_wally, type) \
|
||||
tal_wally_end_onto_( \
|
||||
(parent), (from_wally), \
|
||||
&stringify(type)[0 * sizeof((from_wally) == (type *)0)])
|
||||
void tal_wally_end_onto_(const tal_t *parent,
|
||||
tal_t *from_wally,
|
||||
const char *from_wally_name);
|
||||
|
Loading…
Reference in New Issue
Block a user