Solidity Bug Info

Bug Name Description Severity
AbiEncodeCallLiteralAsFixedBytesBug
Literals used for a fixed length bytes parameter in ``abi.encodeCall`` were encoded incorrectly.
For the encoding, the compiler only considered the types of the expressions in the second argument of ``abi.encodeCall`` itself, but not the parameter types of the function given as first argument. In almost all cases the abi encoding of the type of the expression matches the abi encoding of the parameter type of the given function. This is because the type checker ensures the expression is implicitly convertible to the respective parameter type. However this is not true for number literals used for fixed bytes types shorter than 32 bytes, nor for string literals used for any fixed bytes type. Number literals were encoded as numbers instead of being shifted to become left-aligned. String literals were encoded as dynamically sized memory strings instead of being converted to a left-aligned bytes value.

- Link: https://blog.soliditylang.org/2022/03/16/encodecall-bug/
- First Introduced: 0.8.11
- Fixed in Version: 0.8.13
- Published:
- Severity<: very low

very low