-
Notifications
You must be signed in to change notification settings - Fork 486
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
AVM: base64_decode can decode padded or unpadded encodings #4015
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4015 +/- ##
==========================================
+ Coverage 54.44% 54.48% +0.04%
==========================================
Files 390 390
Lines 48500 48509 +9
==========================================
+ Hits 26406 26432 +26
+ Misses 19867 19855 -12
+ Partials 2227 2222 -5
Continue to review full report at Codecov.
|
data/transactions/logic/eval_test.go
Outdated
{"cGFk====", "StdEncoding", "pad", "input byte 4"}, | ||
|
||
// Test that padding must be present to make len = 0 mod 4. | ||
// Test that padding must be correct of absent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Test that padding must be correct of absent | |
// Test that padding must be correct or absent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, single character typos can be confusing. I meant "or".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - left an optional suggestion to fix a typo in a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
base64 decoding now operates on padded or unpadded encodings. Since \r and \n are ignored while decoding, the approach we take is to look for padding, and use the padded encoding if we find any, or raw if we don't. (This contrasts with how we (I?) expected to do it - by checking if the padding was correct and stripping it off. But that would require scanning the string, not just checking the length.)