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

Bug#616557: marked as done (generated code copies array contents from wrong Lua stack location if preceded by lua_State *)



Your message dated Thu, 23 Oct 2025 13:33:52 +0000
with message-id <[🔎] E1vBvRw-0046Z9-2H@fasolo.debian.org>
and subject line Bug#1118544: Removed package(s) from unstable
has caused the Debian Bug report #616557,
regarding generated code copies array contents from wrong Lua stack location if preceded by lua_State *
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
616557: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=616557
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: tolua++5.1-dev
Severity: normal

If I declare a function in a *.pkg file like this:

void fun(lua_State *state, int numbers[42]);

then tolua++ generates the following stub for Lua to call:

/* function: fun */
#ifndef TOLUA_DISABLE_tolua_huh_fun00
static int tolua_huh_fun00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_istable(tolua_S,1,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  lua_State* state =  tolua_S;
  int numbers[42];
  {
#ifndef TOLUA_RELEASE
   if (!tolua_isnumberarray(tolua_S,2,42,0,&tolua_err))
    goto tolua_lerror;
   else
#endif
   {
    int i;
    for(i=0; i<42;i++)
    numbers[i] = ((int)  tolua_tofieldnumber(tolua_S,2,i+1,0));
   }
  }
  {
   fun(state,numbers);
  }
  {
   int i;
   for(i=0; i<42;i++)
    tolua_pushfieldnumber(tolua_S,2,i+1,(lua_Number) numbers[i]);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'fun'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

In th e tolua_isnumberarray, tolua_tofieldnumber, and
tolua_pushfieldnumber calls, the second argument is wrong.
It should be 1 rather than 2, because "numbers" is the first
parameter in the Lua stack, even though it is the second
parameter of the C++ function.  Note that the generated code
has previously called tolua_istable(tolua_S,1,0,&tolua_err)
with the correct stack index.

If I move the lua_State * parameter to the end of the list,
then "numbers" is the first parameter in both Lua and C++,
and tolua++ generates correct code.

-- System Information:
Debian Release: 6.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Attachment: pgpx_FEkGm6z3.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Version: 1.0.93-5+rm

Dear submitter,

as the package tolua++ has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/1118544

The version of this package that was in Debian prior to this removal
can still be found using https://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Thorsten Alteholz (the ftpmaster behind the curtain)

--- End Message ---

Reply to: