Merge pull request from GHSA-9vx6-7xxf-x967
* add tests for the encode reads dirty data issue * Fix the encode reads dirty data issue * add changeset * trigger the issue without assembly * rename mock * gas optimization * Apply suggestions from code review Co-authored-by: Ernesto García <ernestognw@gmail.com> * alternative fix: cheaper * update comment * fix lint --------- Co-authored-by: Ernesto García <ernestognw@gmail.com>
This commit is contained in:
@ -47,4 +47,13 @@ describe('Strings', function () {
|
||||
expect(await this.mock.$encodeURL(buffer)).to.equal(expected);
|
||||
});
|
||||
});
|
||||
|
||||
it('Encode reads beyond the input buffer into dirty memory', async function () {
|
||||
const mock = await ethers.deployContract('Base64Dirty');
|
||||
const buffer32 = ethers.id('example');
|
||||
const buffer31 = buffer32.slice(0, -2);
|
||||
|
||||
expect(await mock.encode(buffer31)).to.equal(ethers.encodeBase64(buffer31));
|
||||
expect(await mock.encode(buffer32)).to.equal(ethers.encodeBase64(buffer32));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user