Is it possible that Array.push to fail?

I noticed we never check whether it fails or not and thought it can be a vulnerability if an adversary makes it fail.

  • Yes, as a result of out of gas, for example. Aug 7, 2019 at 10:25
  • But you don't need to check it, because the function will simply revert (i.e., the check-line will not be reached). Aug 7, 2019 at 10:27
  • I think this is the answer, go ahead and write this please.
    – ferit
    Aug 7, 2019 at 15:33

1 Answer 1


Yes, it is possible that it fails (i.e. out of gas exception) but the transaction will revert so you don't need to check it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.