lua-users home
lua-l archive

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


On Mon, Mar 31, 2014 at 7:18 PM, Paige DePol <lual@serfnet.org> wrote:
 
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?
 
For C89, you may not have a declaration after the first statement in a block, so

  int res = 0;
  if (size < 0) return res;  /* sanity check */
  CallInfo *ci = L->ci;

 should be

  int res = 0;
  CallInfo *ci = L->ci;
  if (size < 0) return res;  /* sanity check */

or

  int res = 0;
  CallInfo *ci;
  if (size < 0) return res;  /* sanity check */
  ci = L->ci;

You may be able to find these in your code with

-Wdeclaration-after-statement

e