-
Notifications
You must be signed in to change notification settings - Fork 38.6k
i2p: always check the return value of Sock::Wait() #21631
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
Conversation
|
As mentioned in #21630 (comment): a case for |
424246e to
1c1467f
Compare
|
@practicalswift in the |
|
@vasild Yes, I still think it makes sense. |
|
@practicalswift, I agree in general. In this case however there are 6 callers in total, 3 of them check the return value and 3 would have to be cast to Also, the semantic of Anyway, |
I see your point, and your observation may be an indication that In other words, one function which takes |
|
Code review ACK 1c1467f |
|
cr ACK 1c1467f: patch looks correct and agree with laanwj that |
|
|
|
(removed |
|
(removed |
1c1467f i2p: cancel the Accept() method if waiting on the socket errors (Vasil Dimov) Pull request description: If `Sock::Wait()` fails, then cancel the `Accept()` method. Not checking the return value may cause an uninitialized read a few lines below when we read the `occurred` variable. [Spotted](bitcoin#21630 (comment)) by MarcoFalke, thanks! ACKs for top commit: laanwj: Code review ACK 1c1467f practicalswift: cr ACK 1c1467f: patch looks correct and agree with laanwj that `[[nodiscard]]` can be taken in a follow-up PR :) Tree-SHA512: 57fa8a03a4e055999e23121cd9ed1566a585ece0cf68b74223d8c902804cb6890218c9356d60e0560ccacc6c8542a526356c226ebd48e7b299b4572be312d49b
…odiscard]] e286cd0 net: flag relevant Sock methods with [[nodiscard]] (Vasil Dimov) Pull request description: Flag relevant Sock methods with `[[nodiscard]]` to avoid issues like the one fixed in bitcoin/bitcoin#21631. ACKs for top commit: practicalswift: cr ACK e286cd0: the only changes made are additions of `[[nodiscard]]` and `(void)` where appropriate laanwj: Code review ACK e286cd0 Tree-SHA512: addc361968d24912bb625b42f4db557791556bf0ffad818252a89a32d76ac22758ec70f8282dcfbfd77eebec20a8e6bb7557c8ed08d50a58de95378c34955973
e286cd0 net: flag relevant Sock methods with [[nodiscard]] (Vasil Dimov) Pull request description: Flag relevant Sock methods with `[[nodiscard]]` to avoid issues like the one fixed in bitcoin#21631. ACKs for top commit: practicalswift: cr ACK e286cd0: the only changes made are additions of `[[nodiscard]]` and `(void)` where appropriate laanwj: Code review ACK e286cd0 Tree-SHA512: addc361968d24912bb625b42f4db557791556bf0ffad818252a89a32d76ac22758ec70f8282dcfbfd77eebec20a8e6bb7557c8ed08d50a58de95378c34955973
If
Sock::Wait()fails, then cancel theAccept()method.Not checking the return value may cause an uninitialized read a few lines below when we read the
occurredvariable.Spotted by MarcoFalke, thanks!