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

Buffer overflow exception when input contains 'z's #4

Closed
zaxdo opened this issue Jul 6, 2017 · 4 comments
Closed

Buffer overflow exception when input contains 'z's #4

zaxdo opened this issue Jul 6, 2017 · 4 comments

Comments

@zaxdo
Copy link

zaxdo commented Jul 6, 2017

When decoding, the formula for the output size is "input_size * 4 / 5", which does account for the fact that when input contains only 'z's output can be 4 times as large as the output.

@fzakaria
Copy link
Owner

@zaxdo not sure i understand.

I tried this:

    @Test
    public void testOnlyZInput() {
        String payload = "zzzz";
        String encoded = Ascii85.encode(payload.getBytes());
        assertThat(payload, is(new String(Ascii85.decode(encoded), StandardCharsets.US_ASCII)));
    }

@zaxdo
Copy link
Author

zaxdo commented Aug 20, 2017

Do Ascii85.decode("zzzzzzzzzzzzzzzzzzzzzz");

@fzakaria
Copy link
Owner

Fixed this using #10 with the help of @odisseus
Closing this issue.

@fzakaria
Copy link
Owner

I also released a new version 1.2

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