Subtle difference between clone() and join() behavior:
join() pads the updated free memory pointer:
|
// new pointer is old + 0x20 + the footprint of the body |
|
mstore(0x40, add(add(ptr, _footprint), 0x20)) |
While clone() does not:
|
mstore(0x40, add(add(ptr, _len), 0x20)) // write new unused pointer |
If a payload having length other than 32 * N bytes is cloned, this will result in the free memory pointer being not padded with a full word size. Which should not impact the library itself, but its consumers might expect the pointer to be always padded.
Subtle difference between
clone()andjoin()behavior:join()pads the updated free memory pointer:memview-sol/contracts/TypedMemView.sol
Lines 797 to 798 in 79a08cb
While
clone()does not:memview-sol/contracts/TypedMemView.sol
Line 714 in 79a08cb
If a payload having length other than
32 * Nbytes is cloned, this will result in the free memory pointer being not padded with a full word size. Which should not impact the library itself, but its consumers might expect the pointer to be always padded.