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

decode: Don't write past the end of the input buffer #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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