Fix SelectInterruptPipe::read() being called with fd -1#573
Fix SelectInterruptPipe::read() being called with fd -1#573cosminpolifronie wants to merge 3 commits intomachinezone:masterfrom
Conversation
| @@ -67,8 +66,7 @@ namespace ix | |||
|
|
|||
| int timeoutMs = 10; | |||
| bool readyToRead = false; | |||
There was a problem hiding this comment.
I think it's because we don't call init() on that object.
Can you try that, this should become a one liner fix.
There was a problem hiding this comment.
Would this be needed at this stage? As far as I understand from the code the SelectInterrupt is never used again, it was there just to be able to call poll().
There was a problem hiding this comment.
Copilot also cannot find any use for a SelectInterrupt at that location, and also suggest a nullptr.
| @@ -140,11 +139,11 @@ namespace ix | |||
|
|
|||
| uint64_t value = 0; | |||
|
|
|||
There was a problem hiding this comment.
What's wrong with ret for a variable name ?
There was a problem hiding this comment.
Nothing inherently wrong, just gave me the impression that it will be used as the return value for the whole function at first. Just makes the code a bit faster to read for me.
There was a problem hiding this comment.
Ok. In general it's better to keep PR to the minimum viable change, this is just marginally better and debatable, it's about taste I like short names better as long as they aren't cryptic like x.
|
I can see the builds were started before #571 was merged, which contained some mbedtls build system fixes. Could you please re-run the builds so I can focus on the actual issues introduced by this PR? |
1b90fc1 to
0697c4f
Compare
|
Builds are passing now. It seems The |
When using IXWebSocket in our enterprise project, we are getting the following valgrind warning.
Pull request #503 is handling this issue by adding a check to the read location.
This pull requests fixes the root cause, where a
SelectInterruptPtris used without being initialized. ThisSelectInterruptPtris not needed at all at this moment in the code path, so it has been completely replaced with anullptr.Build and tests are passing, and also our enterprise project is not showing the valgrind warning anymore.
Also, to answer #503 (comment), the correct error return value at this place is 0, as the parent class
SelectInterruptalso returns 0 (signaling an error).https://github.com/machinezone/IXWebSocket/blob/master/ixwebsocket/IXSelectInterrupt.cpp#L36