Skip to content
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 slice bounds out of range for readSingleMessage #709

Merged
merged 2 commits into from
Jan 14, 2022

Conversation

wolfstudy
Copy link
Member

@wolfstudy wolfstudy commented Jan 13, 2022

Signed-off-by: xiaolongran xiaolongran@tencent.com

Fixes #702

Motivation

As #702 desc, In some scenarios, when the Read(size uint32) []byte interface in Buffer is called, the panic of a slice out of bounds may occur. So in this pr, the judgment of boundary conditions is added. When the slice is out of bounds, a CommandAck_BatchDeSerializeError error will be sent to the Broker to avoid the Go SDK process being down due to the panic.

image

After adding the current logic, the effect of execution is as follows:

image

Modifications

  • Add logic to check slice boundaries for Read() of Buffer

Signed-off-by: xiaolongran <xiaolongran@tencent.com>
@wolfstudy wolfstudy added this to the v0.8.0 milestone Jan 13, 2022
@wolfstudy wolfstudy self-assigned this Jan 13, 2022
Signed-off-by: xiaolongran <xiaolongran@tencent.com>
@zymap zymap merged commit 244facf into apache:master Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consume panic
2 participants