[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3w2 Test Suite Issues
- From: Paige DePol <lual@...>
- Date: Mon, 31 Mar 2014 18:18:27 -0500
On Mar 31, 2014, at 6:03 PM, Doug Currie <email@example.com> wrote:
> On Mon, Mar 31, 2014 at 6:33 PM, Paige DePol <firstname.lastname@example.org> wrote:
> ... I favour adding the sanity check to lua_checkstack() as it potentially helps prevent future issues should a negative value be passed for 'size'. My fix simply adds one line to lua_checkstack() and changes one comparison in unpack() to fix the issue as well.
> The only argument I have against the change in lua_checkstack() is that it is not necessary, and may affect things I don't understand. [It also uses new C99 features, which is easily fixed.]
> The unpack solution happens to work for this compiler, but uses unspecified compiler behavior since the subtraction still overflows. So, it is not portable.
Upon further reading I think I have a better understanding of the arithmetic overflow issues with respect to signed vs unsigned numbers. Your solution should be the most portable and I will update my patch to use it, thank you!
However, I also think that lua_checkstack() should have some sort of sanity check for negative values as the function does seem to assume that 'size' will always be zero or greater. Which new C99 features does it use, btw?