-
Notifications
You must be signed in to change notification settings - Fork 35.7k
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
p2p: fix ubsan implicit conversion error in CSubNet::ToString() #22586
p2p: fix ubsan implicit conversion error in CSubNet::ToString() #22586
Conversation
untested ACK 835cc11 |
I think it would be helpful to add a comment on why the conversion/check is taking place (as described in op). |
Needs a rebase to revert #22584 |
netaddress.cpp:1190:18: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
835cc11
to
1416a80
Compare
Rebased, added comment and dropped the suppression. |
Code review ACK 1416a80 |
This fix was opened the same day as the suppression, which was merged while the fix was not. It has two ACKs from the first day or two and I suppose if it was going to be merged, it would have been done so by now. |
I think that a fix for this is still needed. Though, I am not too familiar with this code, so I don't feel comfortable to review or merge this myself. |
Sorry for the wrong comment, I already fixed this in commit efd6f90. |
Resolves https://cirrus-ci.com/task/4787303177519104?logs=ci#L3020 related to #22584.
NetmaskBits()
returns -1 if the subnet mask is invalid, which can be incompatible withuint8_t cidr
and should probably be exited from.This allows removing the netaddress UBSan suppression (implicit-signed-integer-truncation).