lua-users home
lua-l archive

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


> Doing this prevents the crash (!)
> 
>     --- src/lobject.old.c   2020-07-01 16:35:34.525256170 +0200
>     +++ src/lobject.c   2020-07-01 16:34:38.293400900 +0200
>     @@ -346,6 +346,7 @@
>        if (ttisinteger(obj))
>          len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj));
>        else {
>     +    fprintf(stderr, "%p\n", buff);
>          len = lua_number2str(buff, MAXNUMBER2STR, fltvalue(obj));
>          if (buff[strspn(buff, "-0123456789")] == '\0') {  /* looks like an int? */
>            buff[len++] = lua_getlocaledecpoint();

If you add this print in 'addnum2buff' instead, does the crash also
disapear?


> Here is the stacktrace in GDB  with -g and Valgrind output:
> 
> https://gist.github.com/catwell/2834a61cca8118b6d5fc4786e7ebed8e

It is strange that the parameter 'obj' appears twice:

    #3  0x00005555555661a4 in tostringbuff (obj=0x7fffffffd830, obj=0x7fffffffd830, buff=<optimized out>) at lobject.c:346

Another strange thing is the value of 'buff', 0x3ff0000000000000. (Not
very "random"...)

-- Roberto