lua-users home
lua-l archive

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

Em qua., 19 de fev. de 2020 às 13:43, Roberto Ierusalimschy <> escreveu:
> Here are some suggestions to lua sources.
> 1. lauxlib.c has one reduced var declaration, patch attached.
> 2. ldblib.c has two reduced vars declaration, patch attached.
> 3. lvm.c (line 1675) possible division by zero?
> 4. ldebug.c (line 305), currentline shadows functions with same name.
> 5. lcode.c or lcode.h luaK_settablesize function argument names inversion.
> lcode.h
> LUAI_FUNC void luaK_settablesize (FuncState *fs, int pc,
>                                                  int ra, int rb, int rc);
> lcode.c
> void luaK_settablesize (FuncState *fs, int pc, int ra, int rc, int rb)
> params 4 e 5

Many thanks. How did you find them? About item 3, I don't see how the
divisor could be zero there, given that 'step' cannot be zero.
You are welcome.
I used cppcheck.
This is fragment of report:
[..\..\lua-5.4.0-beta\src\lvm.c:499] -> [..\..\lua-5.4.0-beta\src\lvm.c:507]: (style) Condition 'L==NULL' is always false
[..\..\lua-5.4.0-beta\src\lvm.c:1667] -> [..\..\lua-5.4.0-beta\src\lvm.c:1675]: (warning) Either the condition 'step>0' is redundant or there is division by zero at line 1675.
You have to consider that these tools generate a lot of false positives.

Ranier Vilela