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

5.0.6解析stream的field长度超过255会解析错误 #6

Open
13111186 opened this issue Apr 12, 2020 · 0 comments
Open

5.0.6解析stream的field长度超过255会解析错误 #6

13111186 opened this issue Apr 12, 2020 · 0 comments

Comments

@13111186
Copy link

13111186 commented Apr 12, 2020

else if special&0xF0 == 0xE0 {
b, err := buf.ReadByte()
if err != nil {
return nil, err
}
length := ((special & 0x0F) << 8) | b
skip = 2 + int(length)
res, err = buf.Slice(int(length))
if err != nil {
return nil, err
}
这段代码在执行:length := ((special & 0x0F) << 8) | b
的时候,左移8位,由于使用byte处理,会丢失左移的8位,只能取到低8位,所以无法处理长度超过255的情况

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant