lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Already, op_arithK checks both operands because it calls op_arith_aux.
> Hence, I proposed op_bitwiseK should check also.
> 
> I wonder how the developers think this inconsistent and unclear implementation.

There is nothing inconsistent here. Arithmetic operations are one
beast, bitwise operations are another, with a different set of rules.

It makes sense, and it is useful, to write both «a + 1» and a + «1.0»,
with different behaviors. It is not useful, and it is actually
bad taste, to write «a | 0.0».


> I think some attacks in the future may use this code in order to leak
> some pointers as integers, as exploiting another bugs.

Binary code is already untrusted in Lua. There are several other
attack points (too many to be worth covering, in our view) once one
can suppy arbitrary binary code to the interpreter. If one
day we re-introduce a static checker for binary code, this
particular check is one that is quite easy to implement offline.

-- Roberto