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

Wrong encoding of bool value #17

Open
daa opened this issue May 19, 2023 · 2 comments
Open

Wrong encoding of bool value #17

daa opened this issue May 19, 2023 · 2 comments
Assignees

Comments

@daa
Copy link

daa commented May 19, 2023

Encoder doesn't set boolean data type in the buffer when the value being encoded is false:

case bool:
var b byte = 0x11
if !v {
b = 0x10
}
buf = append(buf, b)
return buf, 1, nil

False value should be 0x01, not 0x10 as it's set currently.

@negasus negasus self-assigned this May 19, 2023
@negasus
Copy link
Owner

negasus commented May 22, 2023

According with section 3.1 of the documentation https://www.haproxy.org/download/1.9/doc/SPOE.txt, bool type has format: Type (4 bit) and Flag (4 bit).

Maybe I should check it out if I misunderstood?

@daa
Copy link
Author

daa commented May 22, 2023

Quoted code transforms the true value to 0x11 which is correct: flags (higher 4 bits) are 0001 and type (lower 4 bits) is 0001 but the false value is transformed to 0x10 which is wrong: flags are 0001 and type is 0000 but should be vice versa.

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

2 participants