ljcjclljc opened a new pull request, #3357:
URL: https://github.com/apache/brpc/pull/3357
### What problem does this PR solve?
Issue Number: resolve #3356
Problem Summary:
`StreamCreate(StreamId*, Controller&, const StreamOptions*)` ignored the
return
value of the batched overload. When the same `Controller` was reused to
create a
request stream twice, the batched overload correctly returned `-1`, but the
single-stream wrapper still unconditionally accessed `request_streams[0]`.
This could cause out-of-bounds access and crash the process.
### What is changed and the side effects?
Changed:
- Check the return value of the batched `StreamCreate` in the single-stream
wrapper
- Return the error code immediately when the inner call fails
- Add a regression test to verify that the second call on the same
`Controller`
returns `-1` instead of crashing
Side effects:
- Performance effects:
- None
- Breaking backward compatibility:
- No API change
- The behavior changes from crashing on invalid repeated use to returning
`-1`
---
### Check List:
- [x] Please make sure your changes are compilable.
- [x] When providing us with a new feature, it is best to add related tests.
- [x] Please follow
`https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md` .
Fixes#3356
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]