Skip to content

Conversation

@jkczyz
Copy link
Contributor

@jkczyz jkczyz commented Jul 15, 2021

When there are fewer known from feature bytes than known to feature bytes, an index-out-of-bounds error can occur if the from features have unknown features set in a byte past the greatest known from feature byte. This may happen when parsing an invoice, for instance.

This PR adds a test for the fix in #1002. It also removes some unnecessary test code.

valentinewallace and others added 2 commits July 14, 2021 18:55
This was reported by a user when trying to send a payment using the LDK
sample (specifically during route generation when translating a Features
from one context to another)

The problem was we didn't check T::KNOWN_FEATURE_MASK vec length before
indexing into it, due likely to the assumption that known feature vec
lengths are the same across contexts, when they may not be
@codecov
Copy link

codecov bot commented Jul 15, 2021

Codecov Report

Merging #1003 (8723348) into main (afae12e) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1003      +/-   ##
==========================================
- Coverage   90.78%   90.75%   -0.03%     
==========================================
  Files          60       60              
  Lines       30914    30909       -5     
==========================================
- Hits        28064    28053      -11     
- Misses       2850     2856       +6     
Impacted Files Coverage Δ
lightning/src/ln/features.rs 99.70% <100.00%> (-0.01%) ⬇️
lightning/src/routing/router.rs 95.92% <100.00%> (-0.01%) ⬇️
lightning/src/ln/functional_tests.rs 97.31% <0.00%> (-0.10%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afae12e...8723348. Read the comment docs.

When there are fewer known `from` feature bytes than known `to` feature
bytes, an index-out-of-bounds error can occur if the `from` features
have unknown features set in a byte past the greatest known `from`
feature byte.
@jkczyz jkczyz force-pushed the 2021-known-features-mask branch from 9b71f63 to 8723348 Compare July 15, 2021 01:34
@TheBlueMatt TheBlueMatt merged commit 1f1d7c6 into lightningdevkit:main Jul 15, 2021
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.

3 participants