-
Notifications
You must be signed in to change notification settings - Fork 411
Fix crash due to index-out-of-bounds in Feature context-translation #1002
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
Fix crash due to index-out-of-bounds in Feature context-translation #1002
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1002 +/- ##
=======================================
Coverage 90.78% 90.78%
=======================================
Files 60 60
Lines 30914 30915 +1
=======================================
+ Hits 28064 28065 +1
Misses 2850 2850
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: update commit summary s/parsing/translation
and state what the problem was in the description.
let mut flags = Vec::new(); | ||
for (i, byte) in self.flags.iter().enumerate() { | ||
if i < byte_count { | ||
if i < from_byte_count && i < to_byte_count { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can later but won't have time this week. Asked Matt and he's fine with me PR'ing a test separately later, lmk what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No prob. I don't mind doing it if you want to get this merged in the meantime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be awesome! 🙏
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
5bdc22e
to
7497ed2
Compare
Can confirm this solves the issue I reported ( |
This was reported by a user when trying to send a payment using the LDK
sample (specifically during route generation IIUC).