[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PATCH: Add Type Checking in op_bitwiseK
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 23 Apr 2021 10:42:29 -0300
> 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