-
Notifications
You must be signed in to change notification settings - Fork 0
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 does not handle null bytes #1
Comments
When I built and ran the test suite in the latest ruby 3.2.2 container, I got
The delimiters are not too much of an issue for me but the truncation in that four test seems like the problem. Perhaps I need to set some environment flags somehow? |
Hi @lsb I'm not aware of any specifications where Ascii85 should be null terminated. This gem does support the familiar I've checked several other libraries and even this In-browser converter and haven't seen a null-terminated string show up anywhere. I'm guessing that you're trying to use the output of Many of the tests for Ascii85Native are borrowed from the Ascii85 gem, which is intentional because I wanted a performance-focused drop-in replacement for that particular gem. There are lot of tests that check for behavior of invalid Ascii85 encoded streams. This library isn't doing those sanity checks because some of them require to you scan the entire stream before you even try to decode it, making the decode process take significantly longer. I felt it would be disingenuous to remove those failing tests because it makes clear to anyone who's gotten this far that this is library is really just about the encoding and decoding process. If you need something with more validity checks and unique options like zero-value-compression (conversion of
This being said, I've used this in production for a couple of years now on thousands of PDFs and haven't had a single problem, as of yet. It's been a huge performance gain for me, but YMMV. Time permitting, I will try to revisit some of the low-hanging fruit on the failing tests soon, there are several that are quick fixes. I'm open to any PRs you might want to share to "spruce up the place!" Hope this helps, good luck! |
When I Ascii85Native.decode("0etOA2)[BQ3A:Ff"), I expect to see "1234567890\x001". I get "1234567890", which truncates at the null byte.
This is on the latest 1.0.3
The text was updated successfully, but these errors were encountered: