Lourival Pereira Vieira Neto wrote:
> Module Name:  src
> Committed By: lneto
> Date:         Sat Jul 19 17:11:53 UTC 2014
> 
> Modified Files:
>       src/external/mit/lua/dist/src: luaconf.h
> 
> Log Message:
> lua(4): preventing division by zero
> 
> * note: we should raise an error instead of return INTMAX_MAX

Userspace lua returns +inf or -inf. So, something like this would
be even better than your change:

#define luai_numdiv(a,b) \
        ((b) != 0 ? (a)/(b) : (a) > 0 ?  INTMAX_MAX : INTMAX_MIN)

Alex

Reply via email to