No. Maybe there is an API error when iuplua_checkihandle is NULL. The
implementation is this:

 

Ihandle *iuplua_checkihandle(lua_State *L, int pos)

{

  lua_getmetatable(L, pos);   /* t2 = metatable(stack(pos)) */

  lua_pushstring(L, "iup handle");

  lua_gettable(L, LUA_REGISTRYINDEX);  /* t = registry["iup handle"] */

  if (lua_rawequal(L, -2, -1))   /* check (t2==t)? */

  {

    lua_pop (L, 2);

    return *(Ihandle**)lua_touserdata(L, pos);

  } 

  else 

  {

    luaL_argerror(L, pos, "iup handle expected");

    return NULL;

  }

}

 

Compile Lua with debug information, and check in which Lua function call the
error occurs. 

 

Best,

Scuri

 

From: Benoit Germain [mailto:[email protected]] 
Sent: quarta-feira, 19 de fevereiro de 2014 12:42
To: IUP discussion list.
Subject: Re: [Iup-users] [IUP 3.10.1, Windows 7 64] iup.Refresh() causes a
Lua APICHECK assertion

 

I checked the behavior again: I have a Lua51 runtime without APICHECK (the
one from LuaBinaries), where doing iup.Refresh() indeed shows a popup about
the missing parameter. With my Lua52 runtime where APICHECK is enabled, the
program aborts because of an API error. So maybe this is specific to the
iup*52 DLLs?

 

2014-02-18 22:40 GMT+01:00 Benoit Germain <[email protected]>:

Ah ok my bad. I'll check again, but AFAIR, I didn't get a Lua error with a
runtime built without APICHECK. In that case, this means that malicious code
intentionally forgetting the ihandle parameter corrupts the C stack by
potentially overflowing the Lua stack. 

 

2014-02-18 19:21 GMT+01:00 Antonio Scuri <[email protected]>:

Hi Benoit,

 

The iup.Refresh implementation in Lua is actually quite simple:

 

static int Refresh (lua_State *L)

{

  IupRefresh(iuplua_checkihandle(L,1));

  return 0;

}

 

If iuplua_checkihandle is not triggering the same problem in other
functions, I don't know where the problem is.

 

But notice that you Lua code is actually ignoring the Ihandle parameter:

 

iup.Refresh()

 

Then in a regular Lua run will trigger a Lua error.

 

Your call should be

 

iup.Refresh(self)

 

  for instance.

 

Best,

Scuri

 

 

 

From: Benoit Germain [mailto:[email protected]] 
Sent: quinta-feira, 30 de janeiro de 2014 11:52
To: IUP discussion list
Subject: [Iup-users] [IUP 3.10.1, Windows 7 64] iup.Refresh() causes a Lua
APICHECK assertion

 

Hello,

With the attached script run with a Lua runtime I built with APICHECK
enabled, I get an assertion coming from iuplua52.dll when calling
iup.Refresh(). There must be a missing lua_checkstack() somewhere :-).

Regards,



-- 
Benoit.

 

----------------------------------------------------------------------------
--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471
<http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktr
k> &iu=/4140/ostg.clktrk
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users




-- 
Benoit.




-- 
Benoit.

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to