Re: [PATCH] Loop Overflow Bug Fix
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [PATCH] Loop Overflow Bug Fix
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2017年11月15日 11:56:27 -0200
> 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