Skip to content
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

Add fuzzing coverage for BOLT11 invoice deserialization #3054

Merged
merged 3 commits into from
May 8, 2024

Conversation

TheBlueMatt
Copy link
Collaborator

...and fix a bug with wrong byte read offsets.

@TheBlueMatt TheBlueMatt added this to the 0.0.123 milestone May 8, 2024
@valentinewallace
Copy link
Contributor

New file needs to be added to the rustfmt exception list to fix CI.

@codecov-commenter
Copy link

codecov-commenter commented May 8, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 90.89%. Comparing base (2b14cc4) to head (8db1226).
Report is 36 commits behind head on main.

Files Patch % Lines
lightning-invoice/src/de.rs 83.33% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3054      +/-   ##
==========================================
+ Coverage   89.14%   90.89%   +1.74%     
==========================================
  Files         118      118              
  Lines       97850   103621    +5771     
  Branches    97850   103621    +5771     
==========================================
+ Hits        87230    94188    +6958     
+ Misses       8376     7005    -1371     
- Partials     2244     2428     +184     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

When parsing lightning-invoice HRPs we want to read them
char-by-char, tracking at which offset different fields were. Prior
to this commit this was done first by reading char-by-char and then
by indexing using the byte offset which works for ASCII strings but
fails on multi-byte characters.

This commit fixes this issue by simply always walking byte-by-byte
and rejecting multi-byte characters which don't belong in HRPs.
@TheBlueMatt TheBlueMatt merged commit 806b7f0 into lightningdevkit:main May 8, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants