I think we should only copy length_unpadded instead of length here, and the remaining length-length_padded should be filled with null bytes.
This PR fixes the issue and adds a test case to show that the padding works correcty. While technically breaking, this is a bugfix release. The patch is released immediately.
Checklist
[x] Breaking changes are clearly marked as such in the PR description and changelog
[x] New behavior is reflected in tests
[ ] If performance characteristic of an instruction change, update gas costs as well or make a follow-up PR for that
[ ] The specification matches the implemented behavior (link update PR if changes are needed)
Before requesting review
[x] I have reviewed the code myself
[ ] I have created follow-up issues caused by this PR and linked them here
The following bug was reported:
This PR fixes the issue and adds a test case to show that the padding works correcty. While technically breaking, this is a bugfix release. The patch is released immediately.
Checklist
Before requesting review