segfault using string.dump and debug.getinfo

119 views
Skip to first unread message

Hisham

unread,
May 10, 2024, 6:08:02 PMMay 10
to lu...@googlegroups.com
Hi,

I'm getting a segfault when using string.dump and debug.getinfo. I
could reproduce this with Lua 5.4.4, 5.4.6 and 5.4.7-rc1. It does not
happen with 5.4.0.

These three lines cause the crash: (tested on Linux x86-64)

Lua 5.4.7 Copyright (C) 1994-2024 Lua.org, PUC-Rio
> sample = 'print("hello")'
> stripped = load(string.dump(load(sample), true))
> debug.getinfo(stripped, "L").activelines
zsh: segmentation fault src/lua

Thanks,
-- Hisham

blog...@gmail.com

unread,
May 11, 2024, 7:09:58 AMMay 11
to lua-l
Yes
 Lua5.4.6 -> segmentation fault
 Lua5.4.7 -> segmentation fault
 Lua5.3.6 -> table: 0x55cce36c26c0

суббота, 11 мая 2024 г. в 01:08:02 UTC+3, Hisham:

blog...@gmail.com

unread,
May 11, 2024, 8:20:20 AMMay 11
to lua-l
In ldblib.c  line 167 options have value " >L"

  if (!lua_getinfo(L1, options, &ar))
    return luaL_argerror(L, arg+2, "invalid option");

Ii im change options like this


  if (!lua_getinfo(L1,"L", &ar))
    return luaL_argerror(L, arg+2, "invalid option");

recompile lua5.4.7  and execute code

sample = 'print("hello")'
stripped = load(string.dump(load(sample), true))
print(debug.getinfo(stripped, "L"))

dron@gnu:~/test/lua-5.4.7$ ./src/lua test.lua
table: 0x5566677040d0
dron@gnu:~/test/lua-5.4.7$

I have no idea if I did the right thing, I just assumed that the option value was wrong. This is just my observation and debugging via printf :) and not a fix, but I hope it's useful =)
суббота, 11 мая 2024 г. в 14:09:58 UTC+3, blog...@gmail.com:

Roberto Ierusalimschy

unread,
May 11, 2024, 2:32:42 PMMay 11
to lu...@googlegroups.com
Confirmed. Many thanks for the report.

-- Roberto
Reply all
Reply to author
Forward
0 new messages