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

Possible encoder bugfix #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

robamu
Copy link

@robamu robamu commented Jan 2, 2023

Possible fix for #19 .

I do not have proficient understanding of the COBS protocol yet so it would be good if this is thoroughly reviewed.
I compared the Rust implementation with the C implementation from wikipedia and I saw that there is a similar process of an encode pointer double increment. However, this is only done if the algorithm is not finished yet, more explicitely when length is not 0.

In Rust, this is a bit more complicated. I figured that the state machine has to remember when there might be the possibility that the encoding process is done and the destination index does not need to be incremented anymore. I did this with a boolean flag for the encoder struct. If push is called again, then the index needs to be incremented, and this is done before it starts iterating over the data to be pushed.

I ran all the existing tests again and also added a new one for the issue case.

@robamu robamu changed the title this might fix the bug Possible encoder bugfix Jan 2, 2023
@robamu
Copy link
Author

robamu commented Jul 11, 2023

Any updates on this?

@robamu
Copy link
Author

robamu commented Apr 17, 2024

Any chance this could get checked and possibly merged? I'd love to use the upstream again :)

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

Successfully merging this pull request may close these issues.

None yet

1 participant