inline_assembly_calldata.sol 533 B

1234567891011121314151617181920212223
  1. contract foo {
  2. struct test_stru {
  3. uint256 a;
  4. uint256 b;
  5. }
  6. test_stru storage_struct;
  7. function bar(int256[] calldata vl) public view {
  8. test_stru storage tts = storage_struct;
  9. assembly {
  10. // 'a' contains vl memory address
  11. let a := vl.offset
  12. // 'b' contains vl length
  13. let b := vl.length
  14. // This will change the reference of vl
  15. vl.offset := 5
  16. }
  17. // Any usage of vl here may crash the program
  18. }
  19. }