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

AVM: base64_decode can decode padded or unpadded encodings #4015

Merged
merged 1 commit into from
May 22, 2022

Conversation

jannotti
Copy link
Contributor

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.)

@codecov
Copy link

codecov bot commented May 20, 2022

Codecov Report

Merging #4015 (2aa2157) into master (8bd8ab6) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            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     
Impacted Files Coverage Δ
data/transactions/logic/eval.go 89.58% <100.00%> (+0.03%) ⬆️
network/wsNetwork.go 62.99% <0.00%> (+0.19%) ⬆️
catchup/service.go 69.62% <0.00%> (+0.74%) ⬆️
data/abi/abi_type.go 88.62% <0.00%> (+0.94%) ⬆️
network/wsPeer.go 71.94% <0.00%> (+2.77%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8bd8ab6...2aa2157. Read the comment docs.

{"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
Copy link
Contributor

@tzaffi tzaffi May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Test that padding must be correct of absent
// Test that padding must be correct or absent

Copy link
Contributor Author

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".

tzaffi
tzaffi previously approved these changes May 20, 2022
Copy link
Contributor

@tzaffi tzaffi left a 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

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants