lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

>> I have produced a very small patch which only makes adjustments in lvm.c to the OP_FORLOOP and OP_FORPREP opcodes to solve the issue of the edge case where math.maxinteger or math.mininteger are used, or where the sign bit overflowed.
>> 
>> [...]
>> 
>> These two changes fix all the recently described edge cases with for loops so far as I can tell, as well as remaining compatible with all tests in the Lua test suite. Please let me know if I have overlooked something with how this code performs, thanks!
> 
> Did you test corner cases around mininteger limits, too (with positive
> steps)? In particular, what happens if the subtraction (limit - step)
> overflows?
> 
> -- Roberto

Apparently I did not, thank you for mentioning those tests, Roberto.

I am tinkering with my patch to add detection for these particular cases.

~Paige