Files
openzeppelin-contracts/contracts/mocks/Base64Dirty.sol
Hadrien Croubois 92224533b1 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>
2024-02-29 10:03:32 -06:00

20 lines
399 B
Solidity

// 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);
}
}