lua-users home
lua-l archive

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



A critical bug in the LNUM patch has been revealed by Aladdin Lampé (thanks!).

It happens in all LNUM_INT64 compilations of Lua applying the patch, and essentially changes certain 64-bit values (s.a. 0x1 00000001) to small integers (this one to 1) at code compilation (but not always). Anyone using LNUM for 64-bit support is adviced to fix this immediately.

The quick fix is (in ltable.c 'luaH_getint()'):

  if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
    -->
if (cast(unsigned LUA_INTEGER, key-1) < cast(unsigned int, t- >sizearray))

The actual fix on LNUM svn and LuaForge (not uploaded yet) will be a bit different, but both essentially do the same.

Sorry about the issue.

-Asko



Edelleenlähetetty viesti alkaa:

Lähettäjä: Asko Kauppi <askok@dnainternet.net>
Päiväys: 10. huhtikuuta 2009 klo 20:34.08
Vastaanottaja: Lua list <lua@bazar2.conectiva.com.br>
Aihe: LNUM patch Good Friday revise


Happy Easter, everyone.

There's been some fixes to LNUM patch, mostly concerning optimizations on x86 and x86_64 platforms. All known cases of crashing are now solved.

For people using LNUM succesfully on embedded arena, there's nothing much new. But having the fixes done makes me feel better since there's no unknown issues now.

Download patch here:

	http://luaforge.net/frs/?group_id=214

Or check out a pre-applied source base, here:

	svn co svn://slugak.dyndns.org/public/2009/LNUM2

- asko


The LNUM patch allows easy and wide configuration of Lua number types, with the use of simple compiler defines (LNUM_INT32, LNUM_INT64, LNUM_FLOAT, LNUM_DOUBLE, LNUM_LDOUBLE, LNUM_COMPLEX). It provides added integer accuracy (32- or 64-bit), enhances speed on non-FPU systems and allows use of complex numbers (C99 required).