albertodemichelis / squirrel

Official repository for the programming language Squirrel
http://www.squirrel-lang.org
MIT License
912 stars 156 forks source link

Integer overflow crash fix #240

Closed samisalreadytaken closed 2 years ago

samisalreadytaken commented 3 years ago

Replicate crash:

(-0x7FFFFFFF-1) / -1

squirrel 3.0 stable added INT_MIN / -1 integer overflow check inside SQVM::ARITH_OP. However this is never checked because the _OP_DIV instruction executes the _ARITH_NOZERO macro, which only has division by zero check.

This PR adds the check from SQVM::ARITH_OP into _ARITH_NOZERO.