3.31 Pointers

Storage Pointers

There is a security pitfall related to the use of uninitialized storage pointers. Local storage variables that are uninitialized can point to unexpected storage locations within the contract.

This can lead to developers unintentionally modifying the contract state, which can lead to serious vulnerabilities. Given that this is so error-prone, Solidity compiler 0.5.0 started disallowing such pointers.

Function Pointers

There was a security risk in using uninitialized function pointers within constructors of contracts because of a compiler bug that resulted in unexpected behavior.

This compiler bug was present in Solidity versions 0.4.5 to 0.4.26 and 0.5.0 to 0.5.7 and has since been fixed.

Last updated