ElementsProject / ElementsProject/libwally-core

wally_psbt_from_bytes() is difficult to use

Open
#188 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
307
Forks
159
Avg merge
2h 56m
Merged PRs (30d)
4

Description

It does not tell the caller how many bytes it actually used, which is problematic if you're reading from a stream.

We work around this by calling wally_psbt_to_bytes() again!

Also, looking through the implementation, I am not convinced that you don't read past the end of the buffer in various cases. The usual way of handling this is to have all your internal demarshal functions take a "unsigned char **cursor, size_t *max", rather than having explicit length checks.

This has the strong advantage that you can simply continue demarshaling even if you run over the end, and just do the checks at the end.

See: https://github.com/ElementsProject/lightning/blob/master/wire/fromwire.c

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.