-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> * alternative fix: cheaper * update comment * fix lint --------- Co-authored-by: Ernesto García <[email protected]>
- Loading branch information
1 parent
8b4b7b8
commit 9222453
Showing
4 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`Base64`: Fix issue where dirty memory located just after the input buffer is affecting the result. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import {Base64} from "../utils/Base64.sol"; | ||
|
||
contract Base64Dirty { | ||
struct A { | ||
uint256 value; | ||
} | ||
|
||
function encode(bytes memory input) public pure returns (string memory) { | ||
A memory unused = A({value: type(uint256).max}); | ||
// To silence warning | ||
unused; | ||
|
||
return Base64.encode(input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9222453
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.
👍
9222453
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.
👍