Skip to content

Conversation

@madscientist
Copy link

By changing the test program to allocate exactly the correct
amount of space for the decode buffer, we can see (using valgrind)
that the previous algorithm would (depending on the length) write
one byte past the end of the buffer.

Preserve the extra bits in a local variable to be added into the
next byte, rather than storing them in the next byte itself.

By changing the test program to allocate exactly the correct
amount of space for the decode buffer, we can see (using valgrind)
that the previous algorithm would (depending on the length) write
one byte past the end of the buffer.

Preserve the extra bits in a local variable to be added into the
next byte, rather than storing them in the next byte itself.
@zhicheng
Copy link
Owner

What do you mean "exactly the correct amount of space" ? The encode and decode function should work any length of input. not exactly length of input.

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.

2 participants