Calling Decode multiple times from same instance corrupted results #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I was playing around with your
Ascii85
implementation when I discovered that callingDecode
multiple times from the sameAscii85
instance would cause data corruption on successive calls. For example, the following output was generated by changingTestString
to call and printDecode
twiceYou can see the first few characters in the second call have been corrupted. I first spotted this when storing encoded passwords in an XML file then wondering why they weren't working anymore after successive saves :)
Fortunately the fix was simple - so simple it seems a little absurd creating a pull request (especially given it was a demo to accompany your blog post), but that seems to be the GitHub way. Basically, the
Decode
method needs to reset the_tuple
instance variable back to0
prior to doing its thing, and successive calls then work fine without the corruption. (At least I hope so, I haven't really grokked how it truly works).Thanks for providing the helpful class!
Regards;
Richard Moss